Hi,<br><br>I've just started using SIP and have run into some questions. First, given the following pseudo sip code:<br><br>struct Foo<br>{<br>%TypeHeaderCode<br>#include <Foo.h><br>%End<br><br> void bar();<br>
};<br><br>// basically does "return new Foo;"<br>Foo* createFoo()<br><br>// basically does "delete foo;"<br>deleteFoo(Foo* foo /Transfer/);<br><br>Now let's look at some pseudo python code:<br><br>
# creates a Foo* object<br>a = createFoo()<br><br># deletes the created Foo* object<br>deleteFoo(a)<br><br># returns false<br>sip.isdeleted(a)<br><br># crash<br>a.foo()<br><br>I would have expected sip.isdeleted(a) to return true.<br>
<br>If I modify the definition of Foo to inherit from QObject like so:<br><br>
struct Foo: QObject<br>
{<br>
%TypeHeaderCode<br>
#include <Foo.h><br>
%End<br>
<br>
void bar();<br>
};<br><br>with Foo inheriting from QObject, the code above will return true at sip.isdeleted(a). Neat!<br><br>Which brings me to my question: How does SIP detect that the C++ code in deleteFoo() deleted the QObject inherited Foo object? Could you point me to the code which does this detection? I've looked over the documentation and source code, but haven't found anything describing the actual mechanism.<br>
<br>My hope is to understand how this detection works, and possibly use something similar to track when objects are deleted without having to inherit from QObject.<br><br>Thanks,<br><br>nathan<br><br><br>