[PyQt] qdialog, global reference and RuntimeError: underlying C/C++ object has been deleted
Lists SVR
lists at svrinformatica.it
Tue Jan 4 11:21:55 GMT 2011
Il giorno mar, 04/01/2011 alle 11.05 +0100, Detlev Offenbach ha scritto:
> 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?
try:
app_global.mydialog.ui.textEditInput.toPlainText()
except:
create a new dialog and update app_global.mydialog for the next
times
>
>
> > 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110104/b66e5e50/attachment-0001.html>
More information about the PyQt
mailing list