[PyKDE] KDockWidget Crash
Jim Bublitz
jbublitz at nwinternet.com
Tue Sep 9 09:49:00 BST 2003
On Monday September 8 2003 21:18, Russell Valentine wrote:
> I've ran into a problem with KDockMainWindow and KDockWidget.
> I can't figure out how to get it to work without it crashing
> instantly. I've attached a minimal script that has the problem
> I am facing and its backtrace from the KDE Crash Handler. It
> crashes when it gets to the createDockWidget line. I've also
> tried making a new DockWidget bypassing the createDockWidget
> function and I get the same problem.
>
> Versions using:
> pykde-3.7.4
> PyQt-3.8
> qt-3.1.2
> kde-3.1.3
> I notice the KDock stuff in the uisampler isn't there at this
> time. Anyone know what may be wrong and causing the crash?
In kdockwidget.sip, in both KDockMainWindow and KDockArea
classes, change createDockWidget to look like this:
createDockWidget (const QString&,
const QPixmap&,
QWidget*/TransferThis/ = 0,
const QString& = 0,
const QString& = " ")/Factory/;
(change /Transfer/ to /TransferThis/ and add /Factory/ between
the closing paren and semicolon - the slashes are included and
watch the capitalization). And of course (joy) run build.py and
recompile.
In your test program, add 'self' and two empty strings to the
createDockWidget call
self.createDockWidget("Test Main Widget", self.pic, self,
"", "")
and the program will run. 'None' will work for the parent too,
but it crashes on exit (probably still an object ownership issue
between C++ and Python, which is what /TransferThis/ deals
with).
The PyKDE code was incorrect, but fixing it still results in a
crash if you take the defaults. I'm a little curious about
setting the QString& to 0. It'll take some time to look at the
code, mostly because anything in kdeui takes a lot of build and
compile time. But at least there's a workaround. At the very
least, I can implement the "" part of the workaround in C++, but
I'd rather nail down the real problem if possible.
Thanks for the report - these kinds of errors are hard to catch
without testing.
Jim
More information about the PyQt
mailing list