[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/flake/commands
From:       Thorsten Zachmann <t.zachmann () zagge ! de>
Date:       2009-02-22 11:01:44
Message-ID: 1235300504.346954.10736.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 929835 by zachmann:

o This fixes a crash in kspread where a embedded chart is tried to save 8
  times.

If container e.g. a chart is added to document addShape is called with
the KoShape *  for the container multiple times. (8 times for the chart
shape). Looks like that went in due to a small bug. This patch removes
the recursing of subshapes as it looks like all works without doing this.



 M  +2 -16     KoShapeCreateCommand.cpp  
 M  +1 -3      KoShapeCreateCommand.h  


--- trunk/koffice/libs/flake/commands/KoShapeCreateCommand.cpp #929834:929835
@@ -65,7 +65,7 @@
     if (d->shapeParent)
         d->shapeParent->addChild(d->shape);
     // the parent has to be there when it is added to the KoShapeControllerBase
-    recurse(d->shape, Add);
+    d->controller->addShape(d->shape);
     d->deleteShape = false;
 }
 
@@ -75,22 +75,8 @@
     Q_ASSERT(d->shape);
     Q_ASSERT(d->controller);
     // the parent has to be there when it is removed from the KoShapeControllerBase
-    recurse(d->shape, Remove);
+    d->controller->removeShape(d->shape);
     if (d->shapeParent)
         d->shapeParent->removeChild(d->shape);
     d->deleteShape = true;
 }
-
-void KoShapeCreateCommand::recurse(KoShape *shape, const AddRemove ar)
-{
-    if (ar == Remove)
-        d->controller->removeShape(d->shape);
-    else
-        d->controller->addShape(d->shape);
-
-    KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
-    if (container) {
-        foreach(KoShape *child, container->iterator())
-        recurse(child, ar);
-    }
-}
--- trunk/koffice/libs/flake/commands/KoShapeCreateCommand.h #929834:929835
@@ -43,10 +43,8 @@
     void redo();
     /// revert the actions done in redo
     void undo();
-private:
-    enum AddRemove { Add, Remove };
-    void recurse(KoShape *shape, const AddRemove ar);
 
+private:
     class Private;
     Private * const d;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic