[Tutor] underlying C/C++ object has been deleted

Alan Gauld alan.gauld at btinternet.com
Thu Oct 25 09:27:51 CEST 2007


"Lawrence Shafer" <detroit371 at gmail.com> wrote

> files from QT Designer. I am getting the error below and do not
> understand what's going on.

Neither do I but try debugging it to find out which object causes
the error

>  File "atf.py", line 56, in open
>    if self.isUntitled and self.textBrowser.document().isEmpty() and 
> not
> self.isWindowModified():
> RuntimeError: underlying C/C++ object has been deleted

That line refers to 3 objects (not counting self)

Try splitting it so:

if self.isUntitled:
   if self.textBrowser:
      d = self.TextBrowser.document()
      if d.isEmpty():
           if self.isWindowModified():
               # your code here...

Should return the error at the line with the dead reference

Alternatively use a debugger (IDLE/winpdb?) to stop at the
line immediately before the if test and examoine the
various values.

Once you know which object is the problem you have
some chance of fiinding out why...

Beyond that I can't help since I've never used Qt.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list