Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.13.0
-
None
-
697910e5fbd382e78bc1bcbac3f5824aded059b4 (qt/qtbase/5.13)
Description
The following sequence will trigger an assert during the second QPainterPath::moveTo() call:
QPainterPath p; p.moveTo(0., 0.); p.clear(); p.moveTo(0., 0.);
The second moveTo() triggers this assert:
QPainterPath::moveTo() { ... ensureData(); detach(); QPainterPathData *d = d_func(); Q_ASSERT(!d->elements.isEmpty()); ... }
This is because the call to clear() has cleared all the path elements, including the initial MoveTo, but data still exists so it's not re-initialized by the previous ensureData() call.
Maybe QPainterPath::ensureData() shall insert a first null MoveTo element when the d-pointer exists but has empty data (which is the state it's in after a clear).
Or QPainterPath::clear() shall ensure that the path data contains at least a null MoveTo if it's not null.