[PyQt] qdialog, global reference and RuntimeError: underlying C/C++ object has been deleted

Lists SVR lists at svrinformatica.it
Tue Jan 4 09:50:43 GMT 2011


Hi,

I have a dialog that require some time to load, to speed up the things I
keep this dialog in memory, so I create it the first time and then I add
a global reference, something like this:

app_global.mydialog=mydialog

and when this variable is populated I do:

app_global.mydialog.exec_()

this seems to work fine, however in some rare situations (I'm unable to
reproduce sistematically) when I try to open the dialog I have the
error:

RuntimeError: underlying C/C++ object has been deleted

now in my use case this is simple to fix, before open the dialog I check
that the c/C++ object is still there and if not I recreate the whole
dialog and update the global reference, however I would like to know why
qt destroy an object even if I keep a reference to it and how to force
qt to never destroy a QDialog,

thanks
Nicola



More information about the PyQt mailing list