From ad3f9c6dfe0f8e061594c856b9b16ac4dfee8cc7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 25 Oct 2019 01:25:23 +1100 Subject: Fix crash drawing the paint cursor over the redo region Also fix CTX_wm_region_view3d which didn't check the region type. --- source/blender/editors/sculpt_paint/paint_image.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_image.c') diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index b4388f6c324..9acc189ae95 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -759,17 +759,14 @@ void PAINT_OT_image_paint(wmOperatorType *ot) paint_stroke_operator_properties(ot); } -int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) +bool get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) { - RegionView3D *rv3d = CTX_wm_region_view3d(C); - - if (!rv3d) { - SpaceImage *sima = CTX_wm_space_image(C); - + ScrArea *sa = CTX_wm_area(C); + if (sa && sa->spacetype == SPACE_IMAGE) { + SpaceImage *sima = sa->spacedata.first; if (sima->mode == SI_MODE_PAINT) { ARegion *ar = CTX_wm_region(C); ED_space_image_get_zoom(sima, ar, zoomx, zoomy); - return 1; } } -- cgit v1.2.3