From 0060ff674910fd7e81f36c508547367d3c5d4a8c Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 13 May 2019 19:07:54 +0200 Subject: [PATCH] QPainterPathPrivate: code tidies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Honor the RO3, doing copies of the members where it belongs (and not in its subclass), and properly handling the refcounting by disabling the copy assignment * Clean up construction of QPainterPathData by using ctor-init-lists, getting rid of a warning because the base class copy constructor wasn't being called by the subclass' copy constructor. * Mark everything for cleanup in Qt 6. Change-Id: I143a322dc816e2e12b454a9e5ffe63f1a86009a5 Reviewed-by: MÃ¥rten Nordheim --- src/gui/painting/qpainterpath_p.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 98056483bc..8af811499b 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -64,6 +64,7 @@ QT_BEGIN_NAMESPACE +// ### Qt 6: merge with QPainterPathData class QPainterPathPrivate { public: @@ -80,7 +81,19 @@ public: friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPainterPath &); #endif - QPainterPathPrivate() : ref(1) {} + QPainterPathPrivate() noexcept + : ref(1) + { + } + + QPainterPathPrivate(const QPainterPathPrivate &other) noexcept + : ref(1), + elements(other.elements) + { + } + + QPainterPathPrivate &operator=(const QPainterPathPrivate &) = delete; + ~QPainterPathPrivate() = default; private: QAtomicInt ref; @@ -166,28 +179,32 @@ public: QPainterPathData() : cStart(0), fillRule(Qt::OddEvenFill), + require_moveTo(false), dirtyBounds(false), dirtyControlBounds(false), + convex(false), pathConverter(nullptr) { - require_moveTo = false; - convex = false; } QPainterPathData(const QPainterPathData &other) : - QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule), + QPainterPathPrivate(other), + cStart(other.cStart), + fillRule(other.fillRule), bounds(other.bounds), controlBounds(other.controlBounds), + require_moveTo(false), dirtyBounds(other.dirtyBounds), dirtyControlBounds(other.dirtyControlBounds), convex(other.convex), pathConverter(nullptr) { - require_moveTo = false; - elements = other.elements; } - ~QPainterPathData() { + QPainterPathData &operator=(const QPainterPathData &) = delete; + + ~QPainterPathData() + { delete pathConverter; }