[PyKDE] Double free() problem in PyQt 3.15.1??

Simon Edwards simon at simonzone.com
Sat Mar 11 19:13:25 GMT 2006


Hi Phil and everybody else,

I'm busy working on polishing and debugging stuff for the coming Kubuntu 
release, which makes increasingly more use of PyQt+PyKDE BTW.

Anyway, I think I've come across a double free memory bug in PyQt 3.15.1. Qt 
complains about a "Double QObject deletion detected.", and valgrind points to 
a problem in sipKDialogBase::~sipKDialogBase(). (Reading memory which is 
already free'd, and invalid free(), delete etc). This problem only appears 
when my app opens a dialog.

This problem does not occur with PyQt 3.14.1. Comparing the two PyQt releases 
I see this added to the 3.15.1 qdialog.sip:

-----------------------------
%If (- Qt_3_0_0)
	int exec() /PyName=exec_loop, ReleaseGIL,
		    PreHook=__pyQtPreEventLoopHook__,
		    PostHook=__pyQtPostEventLoopHook__/;
%MethodCode
		// Transfer ownership back to Python (a modal dialog will
		// probably have the main window as it's parent).  This means
		// the Qt dialog will be deleted when the Python wrapper is
		// garbage collected.  Although this is a little inconsistent,
		// it saves having to code it explicitly to avoid the memory
		// leak.
		sipTransferBack(sipSelf);

		Py_BEGIN_ALLOW_THREADS
		sipRes = sipCpp->QDialog::exec();
		Py_END_ALLOW_THREADS
%End
%End
-----------------------------

This does look like it could be the problem. Phil?

cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."




More information about the PyQt mailing list