yes, it does crash if you save the object in the variable. But it depends 
on how many times you run p.isNull(). I executed that in maya's script 
editor around 6 or 7 times without crash.
But it crashed at the 8th time or so. What I find strange is that the list 
actually holds the MPlugs, but they become null. Maybe that's why they did 
the MPlugArray for MPlug.destinations()??
Anyways, after almost getting a nervious break down I realised that it was 
coming from there XD. I just spent around 3 hours trying to figure it out. 
Also I tried to read the MayaCrashLog.log file
and it was like reading Klingon. No idea how to underst what it says.

El miércoles, 19 de enero de 2022 a las 19:01:28 UTC+1, [email protected] 
escribió:

>
>
> 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/f7638778-08fe-473d-a043-0462a9acf968n%40googlegroups.com.

Reply via email to