[PyQt] Crash when adding a QRegion to a QPainterPath
Phil Thompson
phil at riverbankcomputing.com
Tue Jun 8 18:28:19 BST 2010
On Tue, 08 Jun 2010 17:45:59 +0100, Jeremy Sanders
<jeremy at jeremysanders.net> wrote:
> Hi - I have an example program here which used to work in earlier
sip/PyQt
> releases. Now it causes a core dump:
>
> #0 QRegion::QRegion (this=0x8f72c0, r=...) at painting/qregion.cpp:3895
> #1 0x0000003ea5ce12ad in QPaintEngineState::clipRegion (this=<value
> optimized out>)
> at painting/qpainter.cpp:8470
> #2 0x00007ffff1040157 in meth_QPaintEngineState_clipRegion
> (sipSelf=0x8c36d0, sipArgs=<value optimized out>)
> at sipQtGuiQPaintEngineState.cpp:385
> #3 0x0000003eb78dcaba in call_function (f=<value optimized out>,
> throwflag=<value optimized out>)
> at Python/ceval.c:3706
>
> This fails under Fedora 12 x86-64 and on a own-built SIP/PyQt4 under
linux
> i386. I'm using Qt-4.6.2.
>
> Please download the example program:
> http://barmag.net/tmp/svg_export.py
>
> If you uncomment the print statements on lines 175 and 177 the program no
> longer crashes, but state.clipOperation() looks like garbage.
Fixed in tonight's PyQt snapshot.
SIP v4.10.1 included an "improvement" where a copy of a const& argument to
a reimplementation of a virtual is made before wrapping it. This means that
Python code doesn't have to explicitly make a copy if it wants to keep a
reference and avoid potential crashes if the copy isn't made. It seems that
in some cases this is the wrong thing to do - particularly if the argument
is actually an internal sub-class of the advertised type.
Phil
More information about the PyQt
mailing list