Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-08-28 12:57:50 +0300
committerCampbell Barton <campbell@blender.org>2022-08-28 13:00:14 +0300
commit219d1095756fda2e54b6168eb65c93e3869722a6 (patch)
treea47a2512aa8d6313c7a7e3355a66b4f74f5dad67
parent1f9d0acfa9efa3634274eda8b9cd3f7846cc5a4f (diff)
Fix crash in gpencil.brush_reset_all referencing freed memory
A reference to the active brush was kept even when it was freed.
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index b7ac73b9692..340288b2d74 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -2076,6 +2076,9 @@ static void gpencil_brush_delete_mode_brushes(Main *bmain,
}
BKE_brush_delete(bmain, brush);
+ if (brush == brush_active) {
+ brush_active = NULL;
+ }
}
}
@@ -2109,8 +2112,8 @@ static int gpencil_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op))
char tool = '0';
if (paint) {
- Brush *brush_active = paint->brush;
- if (brush_active) {
+ if (paint->brush) {
+ Brush *brush_active = paint->brush;
switch (mode) {
case CTX_MODE_PAINT_GPENCIL: {
tool = brush_active->gpencil_tool;