[PyQt] [PyKDE] KCrash, sometimes even glibc
Henrik Pauli
henrik.pauli at gmail.com
Tue Aug 28 07:45:16 BST 2007
On Monday 27 August 2007, Phil Thompson wrote:
> Crashes on exit have two causes...
>
> - PyQt bugs related to object ownership
>
> - C++ objects being deleted in the wrong order (because Python objects are
> being garbage collected in a fairly random order).
>
> To debug these...
>
> - Always use current SIP and PyQt snapshots.
>
They're as new as possible.
> - Strip your application down to the bare minimum while still demonstrating
> the problem - I would expect no more than 100 lines.
>
This is really really tough. Haven't got around to it yet. But there must be
something funky about the way I open windows. There are a few things I
could/should use Dialogs for instead of MainWindows, but for one, the
friendlist window might get a menu bar at some point and that is something
that in my eyes isn't a dialog :) That aside, I don't think the two things
are much different as far as widget ownership and closing them goes... I
found that setting WDestructiveClose destroys the C++ but not the Python
object, which makes for a good deal of runtime errors. If I don't WDC them,
then I have to call .close() on the windows in the main window's queryClose()
else we get stuck with hidden windows (apparently clicking the X button just
hides these KMainWindows) and an app that's unable to exit.
Is there anything special I should be writing in __del__() or anywhere else?
Here's how I make the friendlist window from the event editor (happens when
someone presses Ctrl+F):
def editFriends(self):
if not hasattr(self,"friendeditorWindow") or self.friendeditorWindow is
None:
self.friendeditorWindow =
ljkkdefriendeditor.LJKFriendEditor(self, "ljklient:friendeditor",
Qt.WType_TopLevel)
self.friendeditorWindow.show()
and the queryClose stuff in eventeditor:
def queryClose(self):
if hasattr(self, "friendeditorWindow") and self.friendeditorWindow is not
None:
self.friendeditorWindow.close(True)
if hasattr(self, "previewWindow") and self.previewWindow is not None:
self.previewWindow.close(True)
return True
def queryExit(self):
if app.ljConn.hasSession():
app.ljConn.doLogout()
return True
If this is right, then I guess it's something inside LJKFriendEditor that I'm
doing very wrong.
More information about the PyQt
mailing list