Commit 548df3ba authored by Jan Hambrecht's avatar Jan Hambrecht

fix infinite recursion when accidently connecting to an artistic text

shape that is put on the connection shape we are trying to connect.
both shape were notifying each other of changes, adapting to these 
change and thus causing a new change which the other gets notified of...

please review if that can be backported to branch

svn path=/trunk/koffice/; revision=958899
parent cafa3622
......@@ -286,24 +286,36 @@ void KoConnectionShape::updatePath(const QSizeF &size)
void KoConnectionShape::setConnection1(KoShape * shape1, int connectionPointIndex1)
bool KoConnectionShape::setConnection1(KoShape * shape1, int connectionPointIndex1)
// refuse to connect to a shape that depends on us (e.g. a artistic text shape)
if (hasDependee(shape1))
return false;
if (d->shape1)
d->shape1 = shape1;
if (d->shape1)
d->connectionPointIndex1 = connectionPointIndex1;
return true;
void KoConnectionShape::setConnection2(KoShape * shape2, int connectionPointIndex2)
bool KoConnectionShape::setConnection2(KoShape * shape2, int connectionPointIndex2)
// refuse to connect to a shape that depends on us (e.g. a artistic text shape)
if (hasDependee(shape2))
return false;
if (d->shape2)
d->shape2 = shape2;
if (d->shape2)
d->connectionPointIndex2 = connectionPointIndex2;
return true;
KoConnection KoConnectionShape::connection1() const
......@@ -62,10 +62,10 @@ public:
virtual bool hitTest(const QPointF &position) const;
/// Sets the first shape the connector is connected to
void setConnection1(KoShape * shape1, int connectionPointIndex);
bool setConnection1(KoShape * shape1, int connectionPointIndex);
/// Sets the second shape the connector is connected to
void setConnection2(KoShape * shape2, int connectionPointIndex);
bool setConnection2(KoShape * shape2, int connectionPointIndex);
/// Returns the connection to the first shape
KoConnection connection1() const;
......@@ -1253,6 +1253,11 @@ void KoShape::removeDependee(KoShape * shape)
bool KoShape::hasDependee(KoShape * shape) const
return d->dependees.contains(shape);
void KoShape::notifyShapeChanged(KoShape * shape, ChangeType type)
......@@ -895,6 +895,9 @@ protected:
* @param type the change type
void notifyChangedShape(ChangeType type);
/// Returns if the given shape is dependent on this shape
bool hasDependee(KoShape * shape) const;
friend class KoShapeManager;
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