[PyQt] 'pyqt@riverbankcomputing.com'

Dr Andrew Perella ajp at eutechnyx.com
Fri Nov 9 00:26:53 GMT 2007


 
Ok - I got the bottom of this.
 
1) I had a c++ class with no virtual destructor defined.
2) I wrapped it in sip.
3) Constructed an instance in python
4) Transferred ownership to C++
5) allowed c++ to delete it
 
The sip wrapper still continued to live in the cpp to wrapper hash map.
This would cause nasty crashes.
 
I wonder if there is anything that can be done to fix this or at least
detect it? Adding a virtual destructor and exposing that in the sip
definition fixed it of course.
 
Regards,
Andrew
 

  _____  

From: pyqt-bounces at riverbankcomputing.com
[mailto:pyqt-bounces at riverbankcomputing.com] On Behalf Of Dr Andrew Perella
Sent: 08 November 2007 23:09
To: pyqt at riverbankcomputing.com
Subject: [PyQt] 'pyqt at riverbankcomputing.com'


I get exactly the same objmap.c crash as you in an application I have
written using SIP (but not PyQT).
The crash is timing related - depending on when the garbage collector is
called, the sip hashmap still has a reference sometimes to a freed python
wrapper.
I will investigate further.
 
Cheers,
Andrew
 
P.S. I made the same "fix" you did to objmap.c:
 
while (w != NULL)

{

/* We are removing it from the map here. */

sipSetNotInMap(w);

sip_api_common_dtor(w);

 w = w->next;

 

//extra code "fix" here

if (w==0xdbdbdbdb)

{

printf("WARNING: SIP would normally crash - would try to access freed
memory\n");

w=NULL;

}

}

 

This e-mail is confidential and may be privileged. It may be read, copied
and used only by the intended recipient. No communication sent by e-mail to
or from Eutechnyx is intended to give rise to contractual or other legal
liability, apart from liability which cannot be excluded under English law. 

This email has been scanned for all known viruses by the Email Protection
Agency.

www.eutechnyx.com Eutechnyx Limited. Registered in England No: 2172322 

This email has been scanned for all known viruses by the Email Protection
Agency


This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. No communication sent by e-mail to or from Eutechnyx is intended to give rise to contractual or other legal liability, apart from liability which cannot be excluded under English law. 

This email has been scanned for all known viruses by the Email Protection Agency.


www.eutechnyx.com Eutechnyx Limited. Registered in England No: 2172322

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071109/a59afe0c/attachment-0001.html


More information about the PyQt mailing list