Fix crash in QPainterPath::reserve()
Function did not handle default-constructed (null d_ptr) path correctly. Fixes: QTBUG-76516 Change-Id: I2925d4306f7fce34ece6739b18a8e275e7970837 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
71ed62bc4c
commit
2ce4a9f487
@ -675,8 +675,9 @@ void QPainterPath::reserve(int size)
|
||||
{
|
||||
Q_D(QPainterPath);
|
||||
if ((!d && size > 0) || (d && d->elements.capacity() < size)) {
|
||||
ensureData();
|
||||
detach();
|
||||
d->elements.reserve(size);
|
||||
d_func()->elements.reserve(size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,10 @@ void tst_QPainterPath::reserveAndCapacity()
|
||||
|
||||
p.reserve(0);
|
||||
QVERIFY(p.capacity() >= 1000);
|
||||
|
||||
QPainterPath p2;
|
||||
p2.reserve(10);
|
||||
QVERIFY(p.capacity() >= 10);
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QPainterPath)
|
||||
|
Loading…
Reference in New Issue
Block a user