[Bf-blender-cvs] [bb1e794d580] blender-v2.83-release: Fix T72476: Crash when drag & drop Color in the Image Editor

Robert Guetzkow noreply at git.blender.org
Mon Apr 27 08:50:12 CEST 2020


Commit: bb1e794d5800b450b53161e9cd9a682c2d6816b1
Author: Robert Guetzkow
Date:   Mon Apr 27 16:43:35 2020 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rBbb1e794d5800b450b53161e9cd9a682c2d6816b1

Fix T72476: Crash when drag & drop Color in the Image Editor

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

M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_image_2d.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 1a2b44a03b4..d913bc2e242 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1305,20 +1305,20 @@ void ED_imapaint_bucket_fill(struct bContext *C,
                              wmOperator *op,
                              const int mouse[2])
 {
-  wmWindowManager *wm = CTX_wm_manager(C);
   SpaceImage *sima = CTX_wm_space_image(C);
-  Image *ima = sima->image;
 
-  BKE_undosys_step_push_init_with_type(wm->undo_stack, C, op->type->name, BKE_UNDOSYS_TYPE_IMAGE);
+  if (sima && sima->image) {
+    Image *ima = sima->image;
 
-  ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
+    ED_image_undo_push_begin(op->type->name, PAINT_MODE_TEXTURE_2D);
 
-  float mouse_init[2] = {mouse[0], mouse[1]};
-  paint_2d_bucket_fill(C, color, NULL, mouse_init, NULL, NULL);
+    float mouse_init[2] = {mouse[0], mouse[1]};
+    paint_2d_bucket_fill(C, color, NULL, mouse_init, NULL, NULL);
 
-  BKE_undosys_step_push(wm->undo_stack, C, op->type->name);
+    ED_image_undo_push_end();
 
-  DEG_id_tag_update(&ima->id, 0);
+    DEG_id_tag_update(&ima->id, 0);
+  }
 }
 
 static bool texture_paint_poll(bContext *C)
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 3485941d3df..16ccfaf8286 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1894,7 +1894,7 @@ void paint_2d_bucket_fill(const bContext *C,
   int x_px, y_px;
   uint color_b;
   float color_f[4];
-  float strength = br ? BKE_brush_alpha_get(s->scene, br) : 1.0f;
+  float strength = (s && br) ? BKE_brush_alpha_get(s->scene, br) : 1.0f;
 
   bool do_float;



More information about the Bf-blender-cvs mailing list