diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-03-17 18:51:12 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-03-17 21:37:53 +0100 |
commit | 2409e9b2c7ca433ac1183efb763fdb99edf59235 (patch) | |
tree | 01ebd9248fc1ea77df20974c94fb9ebd483d8355 /src/gui | |
parent | 48ce0bed62199c5ed51f8ba2b9621c767393322a (diff) |
QPainterPath: plug memory leak
The copy operations didn't take into account the recent upgrade
to QESDP, just reimplement them idiomatically and thus avoid a leak.
Change-Id: I796c02b7d7835cfecd8e097c9979a6d431ee3f07
Fixes: QTBUG-91916
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 46a525b7a0..bf77fb8b3e 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -545,12 +545,7 @@ QPainterPath::QPainterPath() noexcept \sa operator=() */ -QPainterPath::QPainterPath(const QPainterPath &other) - : d_ptr(other.d_ptr.data()) -{ - if (d_ptr) - d_ptr->ref.ref(); -} +QPainterPath::QPainterPath(const QPainterPath &other) = default; /*! Creates a QPainterPath object with the given \a startPoint as its @@ -592,12 +587,8 @@ void QPainterPath::ensureData_helper() */ QPainterPath &QPainterPath::operator=(const QPainterPath &other) { - if (other.d_func() != d_func()) { - QPainterPathPrivate *data = other.d_func(); - if (data) - data->ref.ref(); - d_ptr.reset(data); - } + QPainterPath copy(other); + swap(copy); return *this; } |