[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39875] trunk/blender/source/blender/ editors/space_outliner: Fix #28467: Crash while deleting objects in outliner too fast

Sergey Sharybin g.ulairi at gmail.com
Fri Sep 2 15:23:45 CEST 2011


Revision: 39875
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39875
Author:   nazgul
Date:     2011-09-02 13:23:44 +0000 (Fri, 02 Sep 2011)
Log Message:
-----------
Fix #28467: Crash while deleting objects in outliner too fast

Cleanup tree when handling object delete from outliner.
Prevents handling the same tree item twice when clicking fast.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
    trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
    trunk/blender/source/blender/editors/space_outliner/outliner_tree.c

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_intern.h	2011-09-02 12:47:16 UTC (rev 39874)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_intern.h	2011-09-02 13:23:44 UTC (rev 39875)
@@ -129,6 +129,7 @@
 /* outliner_tree.c ----------------------------------------------- */
 
 void outliner_free_tree(ListBase *lb);
+void outliner_cleanup_tree(struct SpaceOops *soops);
 
 TreeElement *outliner_find_tse(struct SpaceOops *soops, TreeStoreElem *tse);
 TreeElement *outliner_find_id(struct SpaceOops *soops, ListBase *lb, struct ID *id);

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tools.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tools.c	2011-09-02 12:47:16 UTC (rev 39874)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tools.c	2011-09-02 13:23:44 UTC (rev 39875)
@@ -287,6 +287,8 @@
 	if(base==NULL) 
 		base= object_in_scene((Object *)tselem->id, scene);
 	if(base) {
+		SpaceOops *soops= CTX_wm_space_outliner(C);
+
 		// check also library later
 		if(scene->obedit==base->object) 
 			ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
@@ -294,6 +296,13 @@
 		ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
 		te->directdata= NULL;
 		tselem->id= NULL;
+
+		/* XXX: tree management normally happens from draw_outliner(), but when
+		        you're clicking to fast on Delete object from context menu in
+		        outliner several mouse events can be handled in one cycle without
+		        handling notifiers/redraw which leads to deleting the same object twice.
+		        cleanup tree here to prevent such cases. */
+		outliner_cleanup_tree(soops);
 	}
 
 }

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tree.c	2011-09-02 12:47:16 UTC (rev 39874)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tree.c	2011-09-02 13:23:44 UTC (rev 39875)
@@ -222,6 +222,12 @@
 	}
 }
 
+void outliner_cleanup_tree(SpaceOops *soops)
+{
+	outliner_free_tree(&soops->tree);
+	outliner_storage_cleanup(soops);
+}
+
 /* Find ith item from the treestore */
 static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
 {




More information about the Bf-blender-cvs mailing list