[PyKDE] Segmentation fault with dynamic creating of widget content

Wido Depping wido.depping at tu-clausthal.de
Tue Jun 17 11:42:01 BST 2003


On Tuesday 17 June 2003 10:26, Phil Thompson wrote:
> On Monday 16 June 2003 11:34 pm, Wido Depping wrote:
> > I have a widget whose children are created dynamicly. if i get new data i
> > have to refresh the widget, delete all it's children and create the
> > child-widgets again. Most of the time this method works, but sometimes i
> > get a segmentation fault.
> > This is the method for the deletion of the children:
> > for x in  self.attributeWidget.children():
> > 	name = str(x.name())
> > 	# this ensures, that the layout is not deleted
> > 	# every label, lineedit and button has a name which starts with 'LDAP'
> > 	if name[:4] == "LDAP":
> > 		x.destroy()
> > 		self.attributeWidget.removeChild(x)
> >
> > So, is my code wrong or is it PyQt's fault? Attached is a backtracke i
> > got from gdb:
>
> What happens if you call removeChild() before you call destroy()?

Then I get a segmentation fault, too. This time it happens, if I refresh the 
widget and then press 'Alt'. It also happens if I minimize and restore the 
window. Also with the same backtrace. 
That's why I executed the destroy() before removeChild(). 


#0  0x402673a0 in QObject::connect(QObject const*, char const*, QObject 
const*, char const*) () from /usr/qt/3/lib/libqt-mt.so.3
#1  0x40266bf3 in QObject::installEventFilter(QObject const*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#2  0x40349e5e in QMenuBar::eventFilter(QObject*, QEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#3  0x41181be6 in sipQMenuBar::eventFilter(QObject*, QEvent*) ()
   from /usr/lib/python2.2/site-packages/libqtcmodule.so
#4  0x4026634e in QObject::activate_filters(QEvent*) () from 
/usr/qt/3/lib/libqt-mt.so.3
#5  0x40266271 in QObject::event(QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#6  0x4029c88c in QWidget::event(QEvent*) () from /usr/qt/3/lib/libqt-mt.so.3
#7  0x40343fe2 in QMainWindow::event(QEvent*) () from 
/usr/qt/3/lib/libqt-mt.so.3
#8  0x4118a66f in sipQMainWindow::event(QEvent*) ()
   from /usr/lib/python2.2/site-packages/libqtcmodule.so
#9  0x4020a644 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#10 0x40209b3c in QApplication::notify(QObject*, QEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#11 0x41360f9b in sipQApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/python2.2/site-packages/libqtcmodule.so
#12 0x40203987 in QAccelManager::tryAccelEvent(QWidget*, QKeyEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#13 0x4020347e in qt_tryAccelEvent(QWidget*, QKeyEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#14 0x401b1f7b in QETWidget::translateKeyEvent(_XEvent const*, bool) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#15 0x401ad6f0 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#16 0x401c2cc1 in QEventLoop::processEvents(unsigned) ()
   from /usr/qt/3/lib/libqt-mt.so.3
#17 0x4021e466 in QEventLoop::enterLoop() () from /usr/qt/3/lib/libqt-mt.so.3
#18 0x4021e308 in QEventLoop::exec() () from /usr/qt/3/lib/libqt-mt.so.3
#19 0x4020a871 in QApplication::exec() () from /usr/qt/3/lib/libqt-mt.so.3
#20 0x4136335b in sipDo_QApplication_exec_loop(_object*, _object*) ()
   from /usr/lib/python2.2/site-packages/libqtcmodule.so
#21 0x080dcaac in PyCFunction_Call ()
#22 0x080788b3 in Py_MakePendingCalls ()
#23 0x08079269 in PyEval_EvalCodeEx ()
#24 0x0807a1fa in PyEval_CallObjectWithKeywords ()
#25 0x080787f5 in Py_MakePendingCalls ()
#26 0x08079269 in PyEval_EvalCodeEx ()
#27 0x0807b777 in PyEval_EvalCode ()
#28 0x080a047b in PyRun_FileExFlags ()
#29 0x0809fc8d in PyRun_SimpleFileExFlags ()
#30 0x08053356 in Py_Main ()
#31 0x08052ecb in main ()
#32 0x4283fdc4 in __libc_start_main () from /lib/libc.so.6




More information about the PyQt mailing list