[Bf-blender-cvs] [bf4198cdaf7] master: Fix crash running "Edit Voxel Size" operator outside of a main 3D View region

Julian Eisel noreply at git.blender.org
Mon Jun 8 15:45:50 CEST 2020


Commit: bf4198cdaf7d4fa1a5f91526fb6bbe84d2fa2a37
Author: Julian Eisel
Date:   Mon Jun 8 15:42:50 2020 +0200
Branches: master
https://developer.blender.org/rBbf4198cdaf7d4fa1a5f91526fb6bbe84d2fa2a37

Fix crash running "Edit Voxel Size" operator outside of a main 3D View region

Accessed `RegionView3D` data from context, which of course would only be set if
actually executed from a main 3D View region.

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

M	source/blender/editors/object/object_remesh.c

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

diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c
index 22869748b22..846db6728f9 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -584,6 +584,11 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
   return OPERATOR_RUNNING_MODAL;
 }
 
+static bool voxel_size_edit_poll(bContext *C)
+{
+  return CTX_wm_region_view3d(C) && object_remesh_poll(C);
+}
+
 void OBJECT_OT_voxel_size_edit(wmOperatorType *ot)
 {
   /* identifiers */
@@ -592,7 +597,7 @@ void OBJECT_OT_voxel_size_edit(wmOperatorType *ot)
   ot->idname = "OBJECT_OT_voxel_size_edit";
 
   /* api callbacks */
-  ot->poll = object_remesh_poll;
+  ot->poll = voxel_size_edit_poll;
   ot->invoke = voxel_size_edit_invoke;
   ot->modal = voxel_size_edit_modal;
   ot->cancel = voxel_size_edit_cancel;



More information about the Bf-blender-cvs mailing list