Commit: 8234f24838ec87a82891e56b1bcc92529d38bbf3
Author: Campbell Barton
Date:   Tue Feb 13 21:00:26 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB8234f24838ec87a82891e56b1bcc92529d38bbf3

Object Mode: Loop over objects for ED_editors_exit

We could loop over active objects but this ensures don't miss any
and avoids complicated context checks.

===================================================================

M       source/blender/editors/util/ed_util.c

===================================================================

diff --git a/source/blender/editors/util/ed_util.c 
b/source/blender/editors/util/ed_util.c
index 02443af0bfc..a5a26cf4d57 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -35,6 +35,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_armature_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_screen_types.h"
@@ -109,7 +110,6 @@ void ED_editors_init(bContext *C)
 void ED_editors_exit(bContext *C)
 {
        Main *bmain = CTX_data_main(C);
-       Scene *sce;
 
        if (!bmain)
                return;
@@ -117,23 +117,20 @@ void ED_editors_exit(bContext *C)
        /* frees all editmode undos */
        undo_editmode_clear();
        ED_undo_paint_free();
-       
-       for (sce = bmain->scene.first; sce; sce = sce->id.next) {
-               if (sce->obedit) {
-                       Object *ob = sce->obedit;
-               
-                       if (ob) {
-                               if (ob->type == OB_MESH) {
-                                       Mesh *me = ob->data;
-                                       if (me->edit_btmesh) {
-                                               EDBM_mesh_free(me->edit_btmesh);
-                                               MEM_freeN(me->edit_btmesh);
-                                               me->edit_btmesh = NULL;
-                                       }
-                               }
-                               else if (ob->type == OB_ARMATURE) {
-                                       ED_armature_edit_free(ob->data);
-                               }
+
+       for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+               if (ob->type == OB_MESH) {
+                       Mesh *me = ob->data;
+                       if (me->edit_btmesh) {
+                               EDBM_mesh_free(me->edit_btmesh);
+                               MEM_freeN(me->edit_btmesh);
+                               me->edit_btmesh = NULL;
+                       }
+               }
+               else if (ob->type == OB_ARMATURE) {
+                       bArmature *arm = ob->data;
+                       if (arm->edbo) {
+                               ED_armature_edit_free(ob->data);
                        }
                }
        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to