From ed6aaace52564ab686f4bfdd682bf85c4eb78c66 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 24 Nov 2011 20:24:03 +0000 Subject: Fix #29371: crash deleting objects in outliner. This was introduced in the bugfix for #28467, it deleted outliner tree while still traversing it. --- source/blender/editors/space_outliner/outliner_tools.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_outliner') diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 27ad2c4fd6d..f4e46d0255d 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -297,8 +297,6 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto 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); @@ -306,15 +304,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto 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); } - } static void id_local_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem) @@ -579,6 +569,14 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if(event==4) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); + + /* 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); + DAG_scene_sort(bmain, scene); str= "Delete Objects"; WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); -- cgit v1.2.3