]> git.tokkee.org Git - inkscape.git/commitdiff

Code

* conn-avoid-ref.cpp: Fix a crashbug that could occur in files
authormjwybrow <mjwybrow@users.sourceforge.net>
Tue, 9 May 2006 04:25:31 +0000 (04:25 +0000)
committermjwybrow <mjwybrow@users.sourceforge.net>
Tue, 9 May 2006 04:25:31 +0000 (04:25 +0000)
      containing connectors if they were loaded from the file chooser
      or from the recent file list.  Fixes bug #1458820.

ChangeLog
src/conn-avoid-ref.cpp

index a23a46842541f7bc8000fd037815fc028fe50007..63842331b1bf9ea293a0212996a537e05fcd7ed3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-08  Michael Wybrow  <mjwybrow@users.sourceforge.net>
+
+       * conn-avoid-ref.cpp: Fix a crashbug that could occur in files
+         containing connectors if they were loaded from the file chooser
+         or from the recent file list.  Fixes bug #1458820.
+
 2006-05-08  MenTaLguY  <mental@rydia.net>
 
        * src/display/curve.h, src/display/curve.cpp, src/dropper-context.cpp:
index d90eca49b1ac20c5e1007517557295736e4bf043..22ddb54250c2a46c2f99ffe63bf1bb888bdad37c 100644 (file)
@@ -74,14 +74,24 @@ void SPAvoidRef::handleSettingChange(void)
     if (desktop == NULL) {
         return;
     }
+    if (sp_desktop_document(desktop) != item->document) {
+        // We don't want to go any further if the active desktop's document
+        // isn't the same as the document that this item is part of.  This
+        // case can happen if a new document is loaded from the file chooser
+        // or via the recent file menu.  In this case, we can end up here
+        // as a rersult of a sp_document_ensure_up_to_date performed on a
+        // document not yet attached to the active desktop.
+        return;
+    }
 
-    Router *router = item->document->router;
-    
     if (new_setting == setting) {
         // Don't need to make any changes
         return;
     }
+    setting = new_setting;
 
+    Router *router = item->document->router;
+    
     _transformed_connection.disconnect();
     if (new_setting) {
         _transformed_connection = item->connectTransformed(
@@ -110,7 +120,6 @@ void SPAvoidRef::handleSettingChange(void)
         router->delShape(shapeRef);
         shapeRef = NULL;
     }
-    setting = new_setting;
 }