# HG changeset patch # User Thinker K.F. Li # Date 1317218079 -28800 # Node ID 5a3597eba722844e2573327792f5fed7c5e84fc4 # Parent 9e7e5f79acc6b4e73259f9d4e54a78b9a77f527b Switch current layer away before removing a layer. We must switch current layer to another one before removing a layer group node. It avoids a crash since inkscape does not know the group node of the layer is removed, and it would emit a signal on this node later. diff -r 9e7e5f79acc6 -r 5a3597eba722 pyink/MBScene.py --- a/pyink/MBScene.py Tue Sep 27 10:45:12 2011 +0800 +++ b/pyink/MBScene.py Wed Sep 28 21:54:39 2011 +0800 @@ -270,6 +270,16 @@ def doRemoveLayer(self, w): domview = self._domviewui layer_idx, frame_idx = domview.get_current_frame() + if layer_idx == 0: # never remove first layer (default) + return + + # We must switch current layer to another one before removing a layer + # group node. It avoids a crash since inkscape does not know the group + # node of the layer is removed, and it would emit a signal on this node + # later. + self.selectSceneObject(layer_idx - 1, frame_idx) + + self._domviewui.remember_current_frame(layer_idx - 1, frame_idx) domview.rm_layer(layer_idx) pass