[PyQt] Getting information about crash/lockup

Mikael Modin micke.modin at gmail.com
Wed Nov 3 01:01:51 GMT 2010

As per Eriks suggestion I have attached the complete sample. Some more
digging by myself and a colleague has shown a solution/workaround as
well, but I'm still confused. The behaviour seem to be different from
the specification.

If you run the attached file you have 2 seconds to minimize the window
and then an additional 5 seconds until the dialog closes. If you have
minimized the dialog before the dialog closes the app.exec_() returns
and the gui thread exits. If you don't minimize the window the dialog
will just show up and then close.

If you add the line "self.setAttribute(Qt.WA_QuitOnClose, False)"
after the line "QDialog.__init__(self, parent)" everything works like
it should.

If you look here: http://doc.qt.nokia.com/4.7/qwidget.html#close it
says that this is correct behaviour iff the window doesn't have a
parent, but my dialog has my main window as a parent so I don't know
why it ignores it and close the whole gui.


On 2 November 2010 23:08, Erik Janssens <Erik.Janssens at conceptive.be> wrote:
> could you post the sample to the list ? it might be of
> interest.
> fortunately I don't run on windows...but I have a windows
> built for testing purposes
> On Tue, 2010-11-02 at 21:39 +1100, Mikael Modin wrote:
>> Hi Erik,
>> Thanks for the tips.
>> I have a minimal sample with the exact same bug. Got it down to 26
>> lines of code and one icon. I've built and run "make install" on the
>> latest SIP and PyQt. If you are running Windows I could send you the
>> sample and see if it's platform-specific.
>> The key seem to be to be close the only visible dialog in a function
>> that is called by a timer from a function that is called by a timer.
>> If I move the close() up one step everything works like it should.
>> Timer -> Function -> Timer -> Function -> close()
>> I've tried both PyQt and PySide and the error occurs the same way in
>> both frameworks so I assume this is based in Qt and not PyQt. I've
>> tried running this through gdb, got the debug symbols but so far I
>> haven't been able to make sense of it.
>> /Mikael
>> On 2 November 2010 17:50, Erik Janssens <Erik.Janssens at conceptive.be> wrote:
>> > Hello Mikael,
>> >
>> > first of all, you should use the latest version of PyQT / QT,
>> > because previous versions have some issues.
>> >
>> > that being said, I have had some reports of customers where our
>> > application crashes indeed  only when running minimized, but I
>> > have not been unable to reproduce it.
>> >
>> > so it would be interesting if you can generate a minimal example
>> > that crashes, try to use as few QT classes as possible.
>> >
>> > when you have a minimal example, you can try to run it with pyqt
>> > and pyside, this can give you a hint wether it's qt or pyqt related.
>> >
>> > the next step is to build both pyqt and qt with debugging information
>> > on your system, this makes it easier to debug using gdb.
>> >
>> > I'd be interested in the results...
>> >
>> > regards,
>> >
>> > Erik
>> >
>> > On Tue, 2010-11-02 at 17:33 +1100, Mikael Modin wrote:
>> >> Hi,
>> >>
>> >> I'm developing a networked multithreaded application using PyQt4 v
>> >> 4.7.4. I'm wondering if there are any tools available to see what
>> >> messages/signals are passed internally by Qt or if you can suggest any
>> >> other good debugging tips/tools.
>> >>
>> >> My problem is this:
>> >> The problem is related to three parts, the main window, system tray
>> >> icon and a dialog. If I click a button that start things with main
>> >> window in normal mode or maximized mode and the dialog pops up
>> >> everything works fine. But If I click the same button, minimise the
>> >> window to tray and the dialog pops up the main Qt thread dissapear
>> >> from the Eclipse thread list in Debug perspective. And with it the
>> >> entire gui. Which at the moment only consists of the system tray icon
>> >> but I think the thread should keep running.
>> >>
>> >> I'm not calling close on the window when minimizing to Tray, I'm just
>> >> hiding it with setVisible(false)
>> >> I'm using the pydev extension with Eclipse 3.5.2.
>> >> The other threads keep running without python exceptions.
>> >> I don't get any python exception from the main thread.
>> >> I tried running it through gdb with "gdb --args python main.py" to see
>> >> if I could catch an exception, signal something that way, nothing.
>> >> This makes me think that the thread somehow locks up completely and
>> >> therefore doesn't show up in Eclipse, but it doesn't crash.
>> >>
>> >> /Mikael Modin
>> >> _______________________________________________
>> >> PyQt mailing list    PyQt at riverbankcomputing.com
>> >> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>> >
>> >
>> >
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_crash_stripped.rar
Type: application/x-rar
Size: 4105 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101103/831d8349/attachment-0001.bin>

More information about the PyQt mailing list