Code

Fixing crash on layer delete undo
authorjoncruz <joncruz@users.sourceforge.net>
Mon, 5 Jun 2006 07:37:48 +0000 (07:37 +0000)
committerjoncruz <joncruz@users.sourceforge.net>
Mon, 5 Jun 2006 07:37:48 +0000 (07:37 +0000)
ChangeLog
src/dialogs/layers-panel.cpp
src/dialogs/layers-panel.h

index fcf98a7445a128eca5fb629a5874a2806414294c..3ea0356ba78ca6500e10b8258b21b548ea604472 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-01  Jon A. Cruz  <jon@joncruz.org>
+
+       * src/dialogs/layers-panel.h, src/dialogs/layers-panel.cpp:
+
+         Blocked signal when changes are not from the layers UI.
+         Fixes bug #1495406.
+
 2006-06-02  Colin Marquardt  <colin@marquardt-home.de>
 
        * TRANSLATORS: Add Stefan Graubner.
index 4faaec2979c42919457310b17aa474caa26d7096..84de2fb86573eec2ce80011bd371066525d1f75d 100644 (file)
@@ -442,15 +442,17 @@ void LayersPanel::_layersChanged()
     SPDocument* document = _desktop->doc();
     SPObject* root = document->root;
     if ( root ) {
+        _selectedConnection.block();
         if ( _mgr && _mgr->includes( root ) ) {
             SPObject* target = _desktop->currentLayer();
-            _store->clear();
+            _store->clear(); // TODO BIG FIX
 
 #if DUMP_LAYERS
             g_message("root:%p  {%s}   [%s]", root, root->id, root->label() );
 #endif // DUMP_LAYERS
             _addLayer( document, root, 0, target, 0 );
         }
+        _selectedConnection.unblock();
     }
 }
 
@@ -511,7 +513,7 @@ void LayersPanel::_pushTreeSelectionToCurrent()
                 _mgr->setCurrentLayer( inTree );
             }
         } else {
-            _mgr->setCurrentLayer( _desktop->doc()->root );
+            _mgr->setCurrentLayer( _desktop->doc()->root ); // TODO BIG FIX
         }
     }
 }
@@ -742,7 +744,7 @@ LayersPanel::LayersPanel() :
     _tree.set_expander_column( *_tree.get_column(nameColNum) );
 
 
-    _tree.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &LayersPanel::_pushTreeSelectionToCurrent) );
+    _selectedConnection = _tree.get_selection()->signal_changed().connect( sigc::mem_fun(*this, &LayersPanel::_pushTreeSelectionToCurrent) );
     _tree.get_selection()->set_select_function( sigc::mem_fun(*this, &LayersPanel::_rowSelectFunction) );
 
     _tree.get_model()->signal_row_changed().connect( sigc::mem_fun(*this, &LayersPanel::_handleRowChange) );
index 76278fa4f6ff5ad14cc4c2cb2565bba38fb330f6..a600191e9f293c4dddb354c4ec7b810ceeaf3068 100644 (file)
@@ -98,6 +98,9 @@ private:
     sigc::connection _removedConnection;
     sigc::connection _opacityConnection;
 
+    // Internal
+    sigc::connection _selectedConnection;
+
     int _maxNestDepth;
     Inkscape::LayerManager* _mgr;
     SPDesktop* _desktop;