[PyKDE] Double free() problem in PyQt 3.15.1??
Phil Thompson
phil at riverbankcomputing.co.uk
Sat Mar 11 19:26:12 GMT 2006
On Saturday 11 March 2006 7:13 pm, Simon Edwards wrote:
> 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.
Opens it? Or when the name goes out of scope?
> 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?
Possibly. How are you constructing the dialog? Does it have a parent? Are the
references to it local or global?
Phil
More information about the PyQt
mailing list