"Underlying C/C++ object has been deleted"
Question: I'm having an exception running a simple application in python 2.7 with Qt.
Code:

    
    
    # *-* coding: utf-8 *-*
    __author__ = 'luismasuelli'
    
    import sys
    from PyQt4 import QtGui
    
    class StreamWidget(QtGui.QWidget):
    
        def __init__(self):
    
            super(StreamWidget, self).__init__(self)
            self.initialize()
    
        def initialize(self):
    
            self.setWindowTitle("Stream capture test")
            self.resize(400, 300)
            self.center()
            self.show()
    
        def center(self):
    
            qr = self.frameGeometry()
            cp = QtGui.QDesktopWidget().availableGeometry().center()
            qr.moveCenter(cp)
            self.move(qr.topLeft())
    
    def main():
    
        app = QtGui.QApplication(sys.argv)
        window = StreamWidget()
        sys.exit(app.exec_())
    
    main()
    

Sh*t:

RuntimeError: underlying C/C++ object has been deleted (at the super() call
line)

What could be the error and how can i solve it? Any help will be appreciated.


Answer: Got the error! I passed a parameter (self) without noticing it. i'm a noob at
that and seems that parameter is the parent widget. passing self is not only
logically wrong but also an uninitialized qt object.

