[PyQt] pykde crash on debian etch / import kparts or khtml
Jim Bublitz
jbublitz at nwinternet.com
Sat Sep 29 05:02:12 BST 2007
On Friday 28 September 2007 07:56, jbd wrote:
> I've got a small problem with an application i'm trying to port from
> sarge to etch. Here is the minimal application which mimics the problem.
> It's a simple QDialog with a QPushButton which triggers a KDirLister and
> print the result on stdout. It works well as long as i don't import
> khtml or kparts.
> I'm running a clean debian etch system :
> kdelibs : 4:3.5.5a.dfsg.1-8
> python-kde3 : 3.15.2+20060422-3
> python-qt3 : 3.16-1.2
> The same code sample runs well on debian sarge but crash on debian etch
> and ubuntu feisty. It seems that's i'm doing something wrong here.
It crashes here too (not on Debian). It appears to be related to the
'newItems' signal - that's where the backtrace indicates the crash is
originating. I have no idea what the cause is, but I think you can achieve
the same thing with the two changes below, and with those changes it works
here.
>From looking at the comments in the KDE h files, it seems like there might be
some kind of timing issues related to the signals, but I have no idea why
importing other modules would trigger the problem.
Jim
> # -*- coding: utf-8 -*-
>
> import sys
>
> from qt import QDialog, QPushButton, SIGNAL
> from kdecore import KCmdLineArgs, KApplication, KURL
> from kio import KDirLister
>
> # Remove one or both of the comment to crash the application
> #from khtml import *
> #from kparts import * #
>
> class TestCrash(QDialog):
> def __init__(self, parent=None):
> QDialog.__init__(self, parent)
> button = QPushButton("Run kdirlister", self)
> self._dirLister = KDirLister()
> self.connect(button, SIGNAL("clicked()"), self._openHome)
># self.connect(self._dirLister, SIGNAL("newItems(const
># KFileItemList&)"),
self.connect(self._dirLister, SIGNAL("completed ()"),
self._slotNewItems)
> self._slotNewItems)
>
> def _openHome(self):
> self._dirLister.openURL(KURL("/"))
>
>
> def _slotNewItems(self, items):
> print "="*50
> # for item in items:
for item in self._dirLister.items ():
> print item.url().prettyURL()
> print "="*50
>
>
> def main():
> try:
> KCmdLineArgs.init(sys.argv, "crash test", "crash test","crash
> test")
> app = KApplication(True, True)
>
> widget = TestCrash()
> widget.show()
> app.setMainWidget(widget)
> res = app.exec_loop()
>
> print "Return value", res
>
> except Exception, what:
> print "Exception catched:", str(what)
> sys.exit(-1)
>
>
> if __name__=="__main__":
> main()
More information about the PyQt
mailing list