On Thu, 20 Jan 2022, 6:35 am Rudi Hammad, <[email protected]> wrote:

> hello,
>
> I though about sharing someting strange that occured to me. I had a method
> that contained
> MPlug.destinations() which as an art requieres an MPlugArray(). For some
> reason, probably because I was in a hurry and I didn't thought about it, I
> casted all the MPlugs from MPlug.destinations() into a python list. Let's
> call it foo=list().
> And that's where I started getting crashes. For instance, if I did
> something like
> foo[0], which is supposed to hold an MPlug, maya return the MPlug okey,
> but if I did foo[0].isNull() it returned True and then crashed.
>
> Whereas if you don't use a python list,  and query directly the
> MPlugArray  (e.g, myMPlugArr[0].isNull) it returns False and everything is
> ok.
>
> So my question more out curiosity than anything else. I know python lists
> are mutable objects, but not sure how or if that could be related.
>
> Cheers,
> R
>

If foo[0] gives you an object, but foo[0].isNull() crashes, then it could
be a bug in the C++ wrapper and how it reference counts. Does it crash if
you first save the object in a variable?
    p = foo[0]
    p.isNull()
I think either way it may be a bug in the wrappers around the C++ memory
and the reference counting.


> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/62002c0d-0c72-43d0-9bd8-5e845d3d43b2n%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/62002c0d-0c72-43d0-9bd8-5e845d3d43b2n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3coz%2BvxPQWjH2extc-Lii_TO38kKXUEjnarMkO_Lnz4g%40mail.gmail.com.

Reply via email to