[Bf-blender-cvs] [c1d8eb01c50] blender-v2.83-release: GPencil: Cleanup wrong ID delete

Antonio Vazquez noreply at git.blender.org
Tue May 12 10:38:38 CEST 2020


Commit: c1d8eb01c50f2b3777333edfa9eefb2255765f34
Author: Antonio Vazquez
Date:   Mon May 11 18:01:24 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBc1d8eb01c50f2b3777333edfa9eefb2255765f34

GPencil: Cleanup wrong ID delete


Differential Revision: https://developer.blender.org/D7691

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

M	source/blender/editors/gpencil/gpencil_fill.c

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

diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index a3f6e10ccb0..0f57862efb2 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -45,6 +45,7 @@
 #include "BKE_gpencil.h"
 #include "BKE_gpencil_geom.h"
 #include "BKE_image.h"
+#include "BKE_lib_id.h"
 #include "BKE_main.h"
 #include "BKE_material.h"
 #include "BKE_paint.h"
@@ -1360,19 +1361,9 @@ static void gpencil_fill_exit(bContext *C, wmOperator *op)
       ED_region_draw_cb_exit(tgpf->region->type, tgpf->draw_handle_3d);
     }
 
-    /* delete temp image */
+    /* Delete temp image. */
     if (tgpf->ima) {
-      for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
-        if (ima == tgpf->ima) {
-          /* XXX This is super, super suspicious!
-           * There should NEVER be any need to handle datablocks in Main in such custom code.
-           * Please change to using BKE_id_free() or similar! */
-          BLI_remlink(&bmain->images, ima);
-          BKE_image_free(tgpf->ima);
-          MEM_SAFE_FREE(tgpf->ima);
-          break;
-        }
-      }
+      BKE_id_free(bmain, tgpf->ima);
     }
 
     /* finally, free memory used by temp data */



More information about the Bf-blender-cvs mailing list