[PyQt] Reopening QT Window - Segfault
Michka Popoff
michkapopoff at gmail.com
Tue Apr 26 10:01:14 BST 2011
Hello, and sorry to re-ask my question, but I really need a working GUI to
display my OpenGL.
I think I have read everything on the web about closing pyQT. Some people
say you can't call QApplication twice, but don't give an alternative
solution. Others give code snippets with app.exec_loop() and not
app.exec_(). Some others use a connection :
connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
This doesn't work either.
I would have switched to someting else, but GLUT or ToGL (Tkinter) are not
very good solutions, wxPython is not compilable for 64 bit under macports,
GTKglext is not working well with macports, GTK apputils is deprecated ...
So I am stuck here : how to create a basic OpenGL window under Linux and Mac
OS X, which can be closed/reopened without crashing and make the main GTK
app quit ...
Thank you in advance !
Michka
2011/4/19 Michka Popoff <michkapopoff at gmail.com>
> 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/20110426/099433fb/attachment.html>
More information about the PyQt
mailing list