On 03/18/2011 03:55 PM, Phil Thompson wrote:
On Fri, 18 Mar 2011 16:20:23 +0000, Phil Thompson
<[email protected]> wrote:
On Fri, 18 Mar 2011 10:54:16 -0500, Rex Dieter<[email protected]>
wrote:
Quoting downstream bug report,
https://bugzilla.redhat.com/show_bug.cgi?id=676042
(Using PyQt-4.8.3)...
When running some simple PyQt4 + QML apps, a segfault can be produced
when
the QML tries to make use of an object that is exposed to it by the
PyQt
code. Changing the code very slightly so that the PyQt4 code has an
extra
reference to the object removes the segfault. This likely means that a
reference to the object is not being created in the PyQt4 declarative
code.
the downstream bug also includes some sample code as a test-case.
It's a feature, not a bug...
PyQt correctly gives an extra reference to the Stopwatch context object
to
the QDeclarativeContext returned by rootContext() to prevent it being
garbage collected. However the QDeclarativeContext Python object (not
the
C++ instance) is itself garbage collected and so the extra reference is
then discarded.
Therefore you need to keep an explicit reference to the Stopwatch
instance
(as in your workaround), or the value returned by rootContext(), or give
the Stopwatch instance a sensible parent.
...on second thoughts I can make this work. Should be fixed in tonight's
SIP and PyQt snapshots.
Thanks, yay!
-- Rex
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt