[PyKDE] Problems with QWidgetFactory
Fredrik Juhlin
laz at strakt.com
Mon Jul 5 16:10:00 BST 2004
On Monday 05 July 2004 12.52, Phil Thompson wrote:
> On Monday 05 July 2004 8:57 am, Fredrik Juhlin wrote:
> > Hi,
> >
> > We've been working on making sure that our application works with the
> > latest versions of Qt, SIP and PyQt (3.3.2, 4.0 and 3.12, respectively.)
> > Doing that, we've come across a problem with QWidgetFactory.
> >
> > Something seems to happen to ownership of the widget returned by
> > QWidgetFactory.create(). If one doesn't keep a reference to the widget it
> > gets destroyed immediately, even if it is given a parent widget.
> > At first I thought that maybe it was intentional (even though it doesn't
> > work that way in older versions) but if we do keep a reference to the
> > widget throughout its life, the program seg faults when the reference is
> > cleaned up.
> >
> > In our application we use our own, subclassed widget factory to create
> > special widgets, but I wrote a simple example using the built-in widget
> > factory to demonstrate the behavior. The example is attached to this
> > mail, along with a trivial .ui-file defining a widget with a QLineEdit
> > and a QPushButton in a QVBoxLayout.
> >
> > The example code displays the behavior when not keeping a reference, but
> > by commenting the chunk of code marked with 1. and de-commenting the
> > chunk marked 2. the widget gets displayed but the app segfaults when it's
> > about to exit.
> >
> > Any help on this matter would be much appreciated!
>
> It's a SIP 4.0 bug. Patch attached and it will be fixed in tonight's
> snapshot. Thanks for the good test case.
That patch did the trick! Thanks a lot.
> I'm very interested in people's experience of moving to SIP 4. Let me know
> when you've completed your testing and I'll release 4.0.1.
The only outstanding issue we have right now is a segfault when exiting the
application. Running the app with a debug-compiled python reveals a
"python: Python/pystate.c:423: PyGILState_Ensure: Assertion
`autoInterpreterState' failed.". I'm not sure what could be causing it, but
I'm compiling a PyQt with debugging turned on as I speak, hoping gdb will
give me a clue (despite my feeble C/C++ skills.)
//Fredrik
More information about the PyQt
mailing list