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

Detlev Offenbach detlev at die-offenbachs.de
Tue Jan 4 10:05:21 GMT 2011


On Dienstag, 4. Januar 2011, Lists SVR wrote:
> 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

What is the code to do that?


> 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
> 
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list