Orange Forum • View topic - underlying C/C++ object has been deleted again

underlying C/C++ object has been deleted again

Report bugs (or imagined bugs).
(Archived/read-only, please use our ticketing system for reporting bugs and their discussion.)
Forum rules
Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

underlying C/C++ object has been deleted again

Postby Evert » Mon Mar 07, 2011 5:35

Hi, I did get the error message above on numerous occasions.

I noticed there's allready a similar message on the board here, and I can confirm that the version I run Orange with, is exactly the same I compiled it with.

I did search the code, and changed a few things, just to track things down ...

Very often I could solve it by changing ...

controlledAttributes = getattr(self, 'controlledAttributes',None)

to

controlledAttributes = self.controlledAttributes ...

(or similar changes)

But then, I get errors elsewhere ... such as ...
'OWChooseImageSizeDlg' object has no attribute 'controlledAttributes'

I'm thinking about testing with hasattr() first ... but ... maybe you should comment first ...

This is on orange-2.0-20101215svn ... (I reverted to this one, after I found that all the nightly builds had issues to (probably the same), on Gentoo amd64, QT 4.7.2

Thx for Orange though ... love it !

Re: underlying C/C++ object has been deleted again

Postby Ales » Mon Mar 07, 2011 11:34

The problem seems to be limited to systems with sip version 4.12.1. Probably because of the added support for __getattr__, __setattr__ ... (http://www.riverbankcomputing.co.uk/news/sip-4121). Can anyone who encounters this error report their sip version. You can check from the python command line with
Code: Select all
import sip
print sip.SIP_VERSION_STR

Re: underlying C/C++ object has been deleted again

Postby Evert » Mon Mar 07, 2011 12:45

Thx,

I'll check tonight ...

That would imply that I would have to install a different version of sip and recompile PyQt4 and PyQwt5 I presume ?

Evert

Re: underlying C/C++ object has been deleted again

Postby Ales » Mon Mar 07, 2011 15:40

I have commited an initial fix for the problem.
For future reference this code no longer works:
Code: Select all
class W(QWidget):
    def __new__(cls):
        self = QWidget.__new__(cls)
        bar = getattr(self, "bar", None)
        return self
       
    def __init__(self):
        foo = getattr(self, "foo", None)
        QWidget.__init__(self)

i.e. any failed attribute lookup before calling the base class __init__ will raise this exception.

OWBaseWidget initialization should probably be reworked further to avoid the use of __new__ method, and fix any widget constructors that do not call the base constructor as the first statement, though this would probably brake any "Save as application" saved schemas.

Re: underlying C/C++ object has been deleted again

Postby Evert » Mon Mar 07, 2011 22:28

I can confirm that rolling back from sip 4.12.1 to 4.12, implying a rollback from PySQT 4.8.3 to 4.8.2 (4.8.3 had dependency on sip 4.12.1) does indeed fix the problem.


Return to Bugs



cron