Commit 4c2bfbd3 authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Explicitly initialize QSharedData in flake private classes

parent a9a53464
...@@ -30,14 +30,17 @@ ...@@ -30,14 +30,17 @@
struct Q_DECL_HIDDEN KoClipMask::Private : public QSharedData struct Q_DECL_HIDDEN KoClipMask::Private : public QSharedData
{ {
Private() {} Private()
: QSharedData()
{}
Private(const Private &rhs) Private(const Private &rhs)
: coordinates(rhs.coordinates), : QSharedData()
contentCoordinates(rhs.contentCoordinates), , coordinates(rhs.coordinates)
maskRect(rhs.maskRect), , contentCoordinates(rhs.contentCoordinates)
extraShapeTransform(rhs.extraShapeTransform) , maskRect(rhs.maskRect)
, extraShapeTransform(rhs.extraShapeTransform)
{ {
// XXX: Use KisDescendent<KoShape> instead of this
Q_FOREACH (KoShape *shape, rhs.shapes) { Q_FOREACH (KoShape *shape, rhs.shapes) {
KoShape *clonedShape = shape->cloneShape(); KoShape *clonedShape = shape->cloneShape();
KIS_ASSERT_RECOVER(clonedShape) { continue; } KIS_ASSERT_RECOVER(clonedShape) { continue; }
......
...@@ -49,14 +49,16 @@ class Q_DECL_HIDDEN KoClipPath::Private : public QSharedData ...@@ -49,14 +49,16 @@ class Q_DECL_HIDDEN KoClipPath::Private : public QSharedData
{ {
public: public:
Private() Private()
: QSharedData()
{} {}
Private(const Private &rhs) Private(const Private &rhs)
: clipPath(rhs.clipPath), : QSharedData()
clipRule(rhs.clipRule), , clipPath(rhs.clipPath)
coordinates(rhs.coordinates), , clipRule(rhs.clipRule)
initialTransformToShape(rhs.initialTransformToShape), , coordinates(rhs.coordinates)
initialShapeSize(rhs.initialShapeSize) , initialTransformToShape(rhs.initialTransformToShape)
, initialShapeSize(rhs.initialShapeSize)
{ {
Q_FOREACH (KoShape *shape, rhs.shapes) { Q_FOREACH (KoShape *shape, rhs.shapes) {
KoShape *clonedShape = shape->cloneShape(); KoShape *clonedShape = shape->cloneShape();
......
...@@ -39,26 +39,26 @@ ...@@ -39,26 +39,26 @@
KoConnectionShape::Private::Private() KoConnectionShape::Private::Private()
: QSharedData() : QSharedData()
, shape1(0), , shape1(0)
shape2(0), , shape2(0)
connectionPointId1(-1), , connectionPointId1(-1)
connectionPointId2(-1), , connectionPointId2(-1)
connectionType(KoConnectionShape::Standard), , connectionType(KoConnectionShape::Standard)
forceUpdate(false), , forceUpdate(false)
hasCustomPath(false) , hasCustomPath(false)
{ {
} }
KoConnectionShape::Private::Private(const KoConnectionShape::Private &rhs) KoConnectionShape::Private::Private(const KoConnectionShape::Private &rhs)
: QSharedData() : QSharedData()
, path(rhs.path), , path(rhs.path)
shape1(0), // FIXME: it should point to the new shapes!!! , shape1(0) // FIXME: it should point to the new shapes!!!
shape2(0), // FIXME: it should point to the new shapes!!! , shape2(0) // FIXME: it should point to the new shapes!!!
connectionPointId1(rhs.connectionPointId1), , connectionPointId1(rhs.connectionPointId1)
connectionPointId2(rhs.connectionPointId2), , connectionPointId2(rhs.connectionPointId2)
connectionType(rhs.connectionType), , connectionType(rhs.connectionType)
forceUpdate(rhs.forceUpdate), , forceUpdate(rhs.forceUpdate)
hasCustomPath(rhs.hasCustomPath) , hasCustomPath(rhs.hasCustomPath)
{ {
} }
......
...@@ -29,11 +29,13 @@ class KoSelection::Private : public QSharedData ...@@ -29,11 +29,13 @@ class KoSelection::Private : public QSharedData
{ {
public: public:
explicit Private() explicit Private()
: activeLayer(0) : QSharedData()
, activeLayer(0)
, selectionChangedCompressor(1, KisSignalCompressor::FIRST_INACTIVE) , selectionChangedCompressor(1, KisSignalCompressor::FIRST_INACTIVE)
{} {}
explicit Private(const Private &) explicit Private(const Private &)
: activeLayer(0) : QSharedData()
, activeLayer(0)
, selectionChangedCompressor(1, KisSignalCompressor::FIRST_INACTIVE) , selectionChangedCompressor(1, KisSignalCompressor::FIRST_INACTIVE)
{ {
} }
......
...@@ -80,28 +80,29 @@ ...@@ -80,28 +80,29 @@
// KoShape::Private // KoShape::Private
KoShape::Private::Private() KoShape::Private::Private()
: size(50, 50), : QSharedData()
parent(0), , size(50, 50)
shadow(0), , parent(0)
border(0), , shadow(0)
filterEffectStack(0), , border(0)
transparency(0.0), , filterEffectStack(0)
zIndex(0), , transparency(0.0)
runThrough(0), , zIndex(0)
visible(true), , runThrough(0)
printable(true), , visible(true)
geometryProtected(false), , printable(true)
keepAspect(false), , geometryProtected(false)
selectable(true), , keepAspect(false)
detectCollision(false), , selectable(true)
protectContent(false), , detectCollision(false)
textRunAroundSide(KoShape::BiggestRunAroundSide), , protectContent(false)
textRunAroundDistanceLeft(0.0), , textRunAroundSide(KoShape::BiggestRunAroundSide)
textRunAroundDistanceTop(0.0), , textRunAroundDistanceLeft(0.0)
textRunAroundDistanceRight(0.0), , textRunAroundDistanceTop(0.0)
textRunAroundDistanceBottom(0.0), , textRunAroundDistanceRight(0.0)
textRunAroundThreshold(0.0), , textRunAroundDistanceBottom(0.0)
textRunAroundContour(KoShape::ContourFull) , textRunAroundThreshold(0.0)
, textRunAroundContour(KoShape::ContourFull)
{ {
connectors[KoConnectionPoint::TopConnectionPoint] = KoConnectionPoint::defaultConnectionPoint(KoConnectionPoint::TopConnectionPoint); connectors[KoConnectionPoint::TopConnectionPoint] = KoConnectionPoint::defaultConnectionPoint(KoConnectionPoint::TopConnectionPoint);
connectors[KoConnectionPoint::RightConnectionPoint] = KoConnectionPoint::defaultConnectionPoint(KoConnectionPoint::RightConnectionPoint); connectors[KoConnectionPoint::RightConnectionPoint] = KoConnectionPoint::defaultConnectionPoint(KoConnectionPoint::RightConnectionPoint);
...@@ -112,47 +113,47 @@ KoShape::Private::Private() ...@@ -112,47 +113,47 @@ KoShape::Private::Private()
KoShape::Private::Private(const Private &rhs) KoShape::Private::Private(const Private &rhs)
: QSharedData() : QSharedData()
, size(rhs.size), , size(rhs.size)
shapeId(rhs.shapeId), , shapeId(rhs.shapeId)
name(rhs.name), , name(rhs.name)
localMatrix(rhs.localMatrix), , localMatrix(rhs.localMatrix)
connectors(rhs.connectors), , connectors(rhs.connectors)
parent(0), // to be initialized later , parent(0) // to be initialized later
shapeManagers(), // to be initialized later , shapeManagers() // to be initialized later
toolDelegates(), // FIXME: how to initialize them? , toolDelegates() // FIXME: how to initialize them?
userData(rhs.userData ? rhs.userData->clone() : 0), , userData(rhs.userData ? rhs.userData->clone() : 0)
stroke(rhs.stroke), , stroke(rhs.stroke)
fill(rhs.fill), , fill(rhs.fill)
inheritBackground(rhs.inheritBackground), , inheritBackground(rhs.inheritBackground)
inheritStroke(rhs.inheritStroke), , inheritStroke(rhs.inheritStroke)
dependees(), // FIXME: how to initialize them? , dependees() // FIXME: how to initialize them?
shadow(0), // WARNING: not implemented in Krita , shadow(0) // WARNING: not implemented in Krita
border(0), // WARNING: not implemented in Krita , border(0) // WARNING: not implemented in Krita
clipPath(rhs.clipPath ? rhs.clipPath->clone() : 0), , clipPath(rhs.clipPath ? rhs.clipPath->clone() : 0)
clipMask(rhs.clipMask ? rhs.clipMask->clone() : 0), , clipMask(rhs.clipMask ? rhs.clipMask->clone() : 0)
additionalAttributes(rhs.additionalAttributes), , additionalAttributes(rhs.additionalAttributes)
additionalStyleAttributes(rhs.additionalStyleAttributes), , additionalStyleAttributes(rhs.additionalStyleAttributes)
filterEffectStack(0), // WARNING: not implemented in Krita , filterEffectStack(0) // WARNING: not implemented in Krita
transparency(rhs.transparency), , transparency(rhs.transparency)
hyperLink(rhs.hyperLink), , hyperLink(rhs.hyperLink)
zIndex(rhs.zIndex), , zIndex(rhs.zIndex)
runThrough(rhs.runThrough), , runThrough(rhs.runThrough)
visible(rhs.visible), , visible(rhs.visible)
printable(rhs.visible), , printable(rhs.visible)
geometryProtected(rhs.geometryProtected), , geometryProtected(rhs.geometryProtected)
keepAspect(rhs.keepAspect), , keepAspect(rhs.keepAspect)
selectable(rhs.selectable), , selectable(rhs.selectable)
detectCollision(rhs.detectCollision), , detectCollision(rhs.detectCollision)
protectContent(rhs.protectContent), , protectContent(rhs.protectContent)
textRunAroundSide(rhs.textRunAroundSide), , textRunAroundSide(rhs.textRunAroundSide)
textRunAroundDistanceLeft(rhs.textRunAroundDistanceLeft), , textRunAroundDistanceLeft(rhs.textRunAroundDistanceLeft)
textRunAroundDistanceTop(rhs.textRunAroundDistanceTop), , textRunAroundDistanceTop(rhs.textRunAroundDistanceTop)
textRunAroundDistanceRight(rhs.textRunAroundDistanceRight), , textRunAroundDistanceRight(rhs.textRunAroundDistanceRight)
textRunAroundDistanceBottom(rhs.textRunAroundDistanceBottom), , textRunAroundDistanceBottom(rhs.textRunAroundDistanceBottom)
textRunAroundThreshold(rhs.textRunAroundThreshold), , textRunAroundThreshold(rhs.textRunAroundThreshold)
textRunAroundContour(rhs.textRunAroundContour) , textRunAroundContour(rhs.textRunAroundContour)
{ {
} }
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#include "kis_assert.h" #include "kis_assert.h"
KoShapeContainer::Private::Private(KoShapeContainer *q) KoShapeContainer::Private::Private(KoShapeContainer *q)
: shapeInterface(q), : shapeInterface(q)
model(0) , model(0)
{ {
} }
......
...@@ -22,14 +22,12 @@ ...@@ -22,14 +22,12 @@
#include "KoShapeContainer.h" #include "KoShapeContainer.h"
#include "kritaflake_export.h" #include "kritaflake_export.h"
#include <QSharedData>
class KoShapeContainerModel; class KoShapeContainerModel;
/** /**
* \internal used private d-pointer class for the \a KoShapeContainer class. * \internal used private d-pointer class for the \a KoShapeContainer class.
*/ */
class KRITAFLAKE_EXPORT KoShapeContainer::Private : public QSharedData class KRITAFLAKE_EXPORT KoShapeContainer::Private
{ {
public: public:
explicit Private(KoShapeContainer *q); explicit Private(KoShapeContainer *q);
......
...@@ -38,12 +38,14 @@ ...@@ -38,12 +38,14 @@
#include <QTextDocument> #include <QTextDocument>
KoTosContainer::Private::Private() KoTosContainer::Private::Private()
: resizeBehavior(KoTosContainer::IndependentSizes) : QSharedData()
, resizeBehavior(KoTosContainer::IndependentSizes)
{ {
} }
KoTosContainer::Private::Private(const Private &rhs) KoTosContainer::Private::Private(const Private &rhs)
: resizeBehavior(rhs.resizeBehavior) : QSharedData()
, resizeBehavior(rhs.resizeBehavior)
, preferredTextRect(rhs.preferredTextRect) , preferredTextRect(rhs.preferredTextRect)
, alignment(rhs.alignment) , alignment(rhs.alignment)
{ {
......
...@@ -856,14 +856,15 @@ KoSvgTextChunkShape::Private::Private() ...@@ -856,14 +856,15 @@ KoSvgTextChunkShape::Private::Private()
} }
KoSvgTextChunkShape::Private::Private(const Private &rhs) KoSvgTextChunkShape::Private::Private(const Private &rhs)
: properties(rhs.properties), : QSharedData()
font(rhs.font), , properties(rhs.properties)
fontFamiliesList(rhs.fontFamiliesList), , font(rhs.font)
localTransformations(rhs.localTransformations), , fontFamiliesList(rhs.fontFamiliesList)
textLength(rhs.textLength), , localTransformations(rhs.localTransformations)
lengthAdjust(rhs.lengthAdjust), , textLength(rhs.textLength)
text(rhs.text), , lengthAdjust(rhs.lengthAdjust)
isRichTextPreferred(rhs.isRichTextPreferred) , text(rhs.text)
, isRichTextPreferred(rhs.isRichTextPreferred)
{ {
} }
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
class Q_DECL_HIDDEN KoTableColumnAndRowStyleManager::Private : public QSharedData class Q_DECL_HIDDEN KoTableColumnAndRowStyleManager::Private : public QSharedData
{ {
public: public:
Private() { } Private() : QSharedData() { }
~Private() { ~Private() {
} }
QVector<KoTableColumnStyle> tableColumnStyles; QVector<KoTableColumnStyle> tableColumnStyles;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment