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-03-07 13:52:24 +0300
committerCampbell Barton <campbell@blender.org>2022-03-07 13:52:24 +0300
commit638c0bd2341708a652b4dd211e6f1e7358cb6dca (patch)
treeae09bccdb75b5f4a48e4ef7437d3bd9b73068ed0 /source/blender/editors/space_view3d/view3d_gizmo_ruler.c
parenta61ee1dcae9b48d9312c8e04c3b3c6e6e3fba578 (diff)
parent0e51defcf42e1cb231d36da9ecc2cc0fbe6ae505 (diff)
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_gizmo_ruler.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index 9b954cd817b..437c2a9a027 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -455,6 +455,19 @@ static bool view3d_ruler_item_mousemove(const bContext *C,
return false;
}
+/**
+ * When the gizmo-group has been created immediately before running an operator
+ * to manipulate rulers, it's possible the new gizmo-group has not yet been initialized.
+ * in 3.0 this happened because left-click drag would both select and add a new ruler,
+ * significantly increasing the likelihood of this happening.
+ * Workaround this crash by checking the gizmo's custom-data has not been cleared.
+ * The key-map has also been modified not to trigger this bug, see T95591.
+ */
+static bool gizmo_ruler_check_for_operator(const wmGizmoGroup *gzgroup)
+{
+ return gzgroup->customdata != NULL;
+}
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -1294,6 +1307,10 @@ static int view3d_ruler_add_invoke(bContext *C, wmOperator *op, const wmEvent *e
wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
const bool use_depth = (v3d->shading.type >= OB_SOLID);
+ if (!gizmo_ruler_check_for_operator(gzgroup)) {
+ return OPERATOR_CANCELLED;
+ }
+
/* Create new line */
RulerItem *ruler_item;
ruler_item = ruler_item_add(gzgroup);
@@ -1369,6 +1386,9 @@ static int view3d_ruler_remove_invoke(bContext *C, wmOperator *op, const wmEvent
wmGizmoMap *gzmap = region->gizmo_map;
wmGizmoGroup *gzgroup = WM_gizmomap_group_find(gzmap, view3d_gzgt_ruler_id);
if (gzgroup) {
+ if (!gizmo_ruler_check_for_operator(gzgroup)) {
+ return OPERATOR_CANCELLED;
+ }
RulerInfo *ruler_info = gzgroup->customdata;
if (ruler_info->item_active) {
RulerItem *ruler_item = ruler_info->item_active;