[PyQt] Reopening QT Window - Segfault

Michka Popoff michkapopoff at gmail.com
Tue Apr 19 10:38:22 BST 2011


Hello

I need some help to implement a QT Window to draw some OpenGL in an
python-GTK2 application.
In the GTK application, I have a push button which will launch an OpenGL
scenery (In a QT window). I should be able to close the OpenGL Window and to
reopen it as many times as I want, without exiting the GTK application.

I used the code found here : http://www.siafoo.net/snippet/316 , but
rewritten for my app (as I call main() from the GTK part) :

def main():
    app = QtGui.QApplication(['Spiral Widget Demo'])
    window = SpiralWidgetDemo()
    window.show()
    app.exec_()


My code works perfectly under Mac OS X with python 2.7 and the pyQT port
from macports. But under Ubuntu 10.10 with python 2.6.6 I get a segmentation
fault if I try to reopen the window.

What I do :

- Open OpenGL Window (QT)
- Close it with the X
- Reopen it
- SegFault here

Why is there a difference between the OS X and ubuntu packages ? I have a
backtrace (made with dgb) of the segfault. It seems that the memory is not
cleared when I close the window. I don't want to use sys.exit because it
will also close my GTK app.


#0  0x0000000000497d72 in ?? ()
#1  0x0000000000499642 in PyErr_WarnEx ()
#2  0x00007ffff536d274 in ?? ()
   from /usr/lib/pymodules/python2.6/gtk-2.0/gobject/_gobject.so
#3  0x00007ffff5a0bb89 in g_logv () from /lib/libglib-2.0.so.0
#4  0x00007ffff5a0bfa3 in g_log () from /lib/libglib-2.0.so.0
#5  0x00007fffe1cde39e in ?? () from /usr/lib/libQtGui.so.4
#6  0x00007fffe1cdf06e in ?? () from /usr/lib/libQtGui.so.4
#7  0x00007fffe1ce4036 in ?? () from /usr/lib/libQtGui.so.4
#8  0x00007fffe1cc78ee in QGtkStyle::QGtkStyle() () from
/usr/lib/libQtGui.so.4
#9  0x00007fffe1c4dda3 in QStyleFactory::create(QString const&) ()
   from /usr/lib/libQtGui.so.4
#10 0x00007fffe193cfa7 in QApplication::style() () from
/usr/lib/libQtGui.so.4
#11 0x00007fffe1945be5 in QApplicationPrivate::initialize() ()
   from /usr/lib/libQtGui.so.4
#12 0x00007fffe1945d01 in QApplicationPrivate::construct(_XDisplay*,
unsigned long, unsigned long) () from /usr/lib/libQtGui.so.4
#13 0x00007fffe1946d91 in QApplication::QApplication(int&, char**, int) ()
   from /usr/lib/libQtGui.so.4
#14 0x00007fffe291f654 in ?? ()
   from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so
#15 0x00007fffe291f73d in ?? ()
   from /usr/lib/pymodules/python2.6/PyQt4/QtGui.so

Thank you in advance if somebody has any explanation why this happens and
how to close the window properly and free up memory/threads which are
perhaps still open.


Michka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110419/334fe1aa/attachment.html>


More information about the PyQt mailing list