[Bf-blender-cvs] [9676cb6d8df] blender-v3.3-release: Fix T102092: GPencil Sculpt Grab crash using Shift key

Antonio Vazquez noreply at git.blender.org
Mon Nov 28 14:21:54 CET 2022


Commit: 9676cb6d8dfc6b6ac6c51fd2b5f6cf82d9d42d1b
Author: Antonio Vazquez
Date:   Thu Oct 27 16:46:51 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rB9676cb6d8dfc6b6ac6c51fd2b5f6cf82d9d42d1b

Fix T102092: GPencil Sculpt Grab crash using Shift key

There was a problem with the hash table that was 
not created as expected.

Also fixed an unreported memory leak in Grab tool not
related to this crash but detected during debug.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 424544c8085..f47ec78ce33 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -1202,6 +1202,9 @@ static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op)
     gso->automasking_strokes = BLI_ghash_ptr_new(__func__);
   }
   else {
+    if (gso->automasking_strokes != NULL) {
+      BLI_ghash_free(gso->automasking_strokes, NULL, NULL);
+    }
     gso->automasking_strokes = NULL;
   }
   /* save mask */
@@ -1292,6 +1295,10 @@ static void gpencil_sculpt_brush_exit(bContext *C, wmOperator *op)
     }
 
     default:
+      if (gso->stroke_customdata != NULL) {
+        BLI_ghash_free(gso->stroke_customdata, NULL, NULL);
+        gso->stroke_customdata = NULL;
+      }
       break;
   }
 
@@ -2075,6 +2082,20 @@ static void gpencil_sculpt_brush_apply_event(bContext *C, wmOperator *op, const
     if (gso->brush == NULL) {
       gso->brush = gso->brush_prev;
     }
+    Brush *brush = gso->brush;
+    if (brush->gpencil_settings->sculpt_mode_flag &
+        (GP_SCULPT_FLAGMODE_AUTOMASK_STROKE | GP_SCULPT_FLAGMODE_AUTOMASK_LAYER |
+         GP_SCULPT_FLAGMODE_AUTOMASK_MATERIAL)) {
+      if (gso->automasking_strokes == NULL) {
+        gso->automasking_strokes = BLI_ghash_ptr_new(__func__);
+      }
+    }
+    else {
+      if (gso->automasking_strokes != NULL) {
+        BLI_ghash_free(gso->automasking_strokes, NULL, NULL);
+      }
+      gso->automasking_strokes = NULL;
+    }
   }
   else {
     if (gso->brush_prev != NULL) {



More information about the Bf-blender-cvs mailing list