[PyQt] Getting a segfault when I close my program

dizou di_zou at yahoo.com
Fri Mar 5 21:27:22 GMT 2010


So when I close my program either by clicking the little x or by calling
close(), I get a segfault. Here is the traceback:

#0  0x0000000000000051 in ?? ()
#1  0x00002afb62cc5ada in QGridLayoutPrivate::deleteAll (this=0xdd9cd50)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qgridlayout.cpp:73
#2  0x00002afb62cc5c52 in ~QGridLayout (this=0xde2a570)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qgridlayout.cpp:1177
#3  0x00002afb6255af75 in ?? ()
   from
/usr/cta/CSE/Release/pyqt-4.6.1/lib/python2.5/site-packages/PyQt4/QtGui.so
#4  0x00002afb62cc5ada in QGridLayoutPrivate::deleteAll (this=0xdd9dfe0)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qgridlayout.cpp:73
#5  0x00002afb62cc5c52 in ~QGridLayout (this=0xdd9df90)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qgridlayout.cpp:1177
#6  0x00002afb6255af75 in ?? ()
   from
/usr/cta/CSE/Release/pyqt-4.6.1/lib/python2.5/site-packages/PyQt4/QtGui.so
#7  0x00002afb62ceaba4 in ~QWidget (this=0xdd5d4f0)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qwidget.cpp:1324
#8  0x00002afb626eb5d5 in ?? ()
---Type <return> to continue, or q <return> to quit---
   from
/usr/cta/CSE/Release/pyqt-4.6.1/lib/python2.5/site-packages/PyQt4/QtGui.so
#9  0x00002afb6386c877 in QObjectPrivate::deleteChildren (this=0xdd59370)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/corelib/kernel/qobject.cpp:1838
#10 0x00002afb62ceacb3 in ~QWidget (this=0xdd59300)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/qt-4.5.2/src/gui/kernel/qwidget.cpp:1367
#11 0x00002afb624ec375 in ?? ()
   from
/usr/cta/CSE/Release/pyqt-4.6.1/lib/python2.5/site-packages/PyQt4/QtGui.so
#12 0x00002afb624e536d in ?? ()
   from
/usr/cta/CSE/Release/pyqt-4.6.1/lib/python2.5/site-packages/PyQt4/QtGui.so
#13 0x00002afb63b5df44 in ?? ()
   from /usr/cta/CSE/Release/sip-4.9.1/lib/python2.5/site-packages/sip.so
#14 0x00002afb63b5df59 in ?? ()
   from /usr/cta/CSE/Release/sip-4.9.1/lib/python2.5/site-packages/sip.so
#15 0x00002afb5e7b7a77 in subtype_dealloc (self=0xd9c5c88)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Objects/typeobject.c:709
#16 0x00002afb5e79d1fd in insertdict (mp=0xcd64930, key=0x2afb5eb2ad80, 
    hash=5157360610513125570, value=0x2afb5ea74b50)
---Type <return> to continue, or q <return> to quit---
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Objects/dictobject.c:416
#17 0x00002afb5e79efef in PyDict_SetItem (op=0xcd64930, key=0x2afb5eb2ad80, 
    value=0x2afb5ea74b50)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Objects/dictobject.c:641
#18 0x00002afb5e7a129e in _PyModule_Clear (m=<value optimized out>)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Objects/moduleobject.c:136
#19 0x00002afb5e802cd6 in PyImport_Cleanup ()
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Python/import.c:439
#20 0x00002afb5e80e73c in Py_Finalize ()
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Python/pythonrun.c:399
#21 0x00002afb5e80e858 in Py_Exit (sts=232426096)
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Python/pythonrun.c:1618
#22 0x00002afb5e80e965 in handle_system_exit ()
    at
/home/cse/CSE/build_stable/CMakeExternals/Source/python-2.5.2/Python/pythonrun.c:1054
#23 0x00002afb5e80eb98 in PyErr_PrintEx (set_sys_last_vars=1)

Here is my code for the layouts:

Main.py:
app = QtGui.QApplication(sys.argv)
    
widget = MainWindow()
widget.resize(1300, 900)
widget.show()

sys.exit(app.exec_())

MainWindow.py:
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        
        self.main = MainWidget()
        
        self.setCentralWidget(self.main)

        self.exitAct = QAction("Exit", self)
        self.exitAct.setShortcut("Ctrl+Q")
        self.connect(self.exitAct, SIGNAL("triggered()"), self, 
                     SLOT("close()"))

MainWidget.py:
class MainWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)

        self.newButton = QToolButton()
        
        self.updateButton = QToolButton()

        treeControlLayout = QGridLayout()
        treeControlLayout.addWidget(self.newButton, 0, 0)
        
        viewControlLayout = QGridLayout()
        viewControlLayout.addWidget(self.updateButton, 0, 0, Qt.AlignCenter)
        
        gridLayout = QGridLayout()
        gridLayout.addLayout(treeControlLayout, 0, 0)
        gridLayout.addWidget(self.tree, 1, 0)
        gridLayout.addLayout(viewControlLayout, 0, 1)
        gridLayout.addWidget(self.view, 1, 1)
        
        self.setLayout(gridLayout)

I have QGridLayouts inside of QGridLayouts, so is it not deleting those
properly? 
-- 
View this message in context: http://old.nabble.com/Getting-a-segfault-when-I-close-my-program-tp27799395p27799395.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list