Thank you. That was very informative and helpful.

---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> On Feb 6, 2020, at 12:00 PM, John Ehresman <j...@wingware.com> wrote:
> 
> On 2/7/20 9:41 AM, Israel Brewster wrote:
>> On Feb 6, 2020, at 11:28 AM, John Ehresman <j...@wingware.com 
>> <mailto:j...@wingware.com>> wrote:
>>> 
>>> In general, del in Python is very different than delete in C++.  I'll leave 
>>> it to others to explain. 
>> In general, sure. In general, python memory management is very different 
>> than C/C++ memory management, so it stands to reason that del/delete would, 
>> in general, be different as well. I’m not asking about the general case, I’m 
>> asking about the Qt case, and the things that Qt does when you delete a Qt 
>> object. I’m not asking for a low-level view of memory management. I’m asking 
>> if the *behavior*, as far as *Qt* objects is concerned, is the same.
> 
> With PyQt or PySide, C++ delete is called when the last Python reference is 
> dropped to an object created from Python (there are other conditions as 
> well).  Python del will drop a reference to the object so C++ delete will be 
> invoked if there are no other references to the object (and other conditions 
> are met).  In my experience, relying on this is a mistake because there are 
> often other references in all but the simplest examples.
>>> or PySide may expose a function to do a C++ delete -- it's probably 
>>> shiboken.delete().
>> That sounds like what I’m looking for, assuming that a python del doesn’t do 
>> the same thing.
> 
> If you want to be sure C++ delete is called, I recommend that you use the 
> function to call it.
> 
> John

_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to