[Bf-blender-cvs] [cb6e3e82b0b] master: GPencil: Make GP_EDITABLE_STROKES_BEGIN macro safe when stroke is removed

Antonio Vazquez noreply at git.blender.org
Fri Aug 2 11:30:11 CEST 2019


Commit: cb6e3e82b0bce60a8d6c121e3218398356171120
Author: Antonio Vazquez
Date:   Fri Aug 2 11:22:08 2019 +0200
Branches: master
https://developer.blender.org/rBcb6e3e82b0bce60a8d6c121e3218398356171120

GPencil: Make GP_EDITABLE_STROKES_BEGIN macro safe when stroke is removed

If the macro was used in a loop where the stroke was removed, the macro failed.

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

M	source/blender/editors/gpencil/gpencil_intern.h

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

diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index a8a3c2f9306..1c20da4bed3 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -610,7 +610,9 @@ struct GP_EditableStrokes_Iter {
           ED_gpencil_parent_location(depsgraph_, obact_, gpd_, gpl, gpstroke_iter.diff_mat); \
           invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
           /* loop over strokes */ \
-          for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gps->next) { \
+          bGPDstroke *gpsn_; \
+          for (bGPDstroke *gps = gpf_->strokes.first; gps; gps = gpsn_) { \
+            gpsn_ = gps->next; \
             /* skip strokes that are invalid for current view */ \
             if (ED_gpencil_stroke_can_use(C, gps) == false) \
               continue; \



More information about the Bf-blender-cvs mailing list