From 045c16ba77c8a7ca6bb67486207a5b803ecb8ffe Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 18 Aug 2023 09:42:31 +0200 Subject: [PATCH 1/4] fix crash --- source/blender/editors/screen/screen_ops.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 4a81ceb220d..142642d2620 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -3237,7 +3237,13 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op) static bool keyframe_jump_poll(bContext *C) { /* There is a keyframe jump operator specifically for the Graph Editor. */ - return ED_operator_screenactive_norender(C) && CTX_wm_area(C)->spacetype != SPACE_GRAPH; + ScrArea *area = CTX_wm_area(C); + /* The area can be a nullptr when two main windows are open and you call the search menu on the + * non-active window. */ + if (area == nullptr) { + return false; + } + return ED_operator_screenactive_norender(C) && area->spacetype != SPACE_GRAPH; } static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) -- 2.30.2 From c6f83ad86f7a3132995a82f938fb41fac06d3f5f Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Fri, 18 Aug 2023 09:45:06 +0200 Subject: [PATCH 2/4] don't always return false --- source/blender/editors/screen/screen_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 142642d2620..3bf2708158c 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -3241,7 +3241,7 @@ static bool keyframe_jump_poll(bContext *C) /* The area can be a nullptr when two main windows are open and you call the search menu on the * non-active window. */ if (area == nullptr) { - return false; + return ED_operator_screenactive_norender(C); } return ED_operator_screenactive_norender(C) && area->spacetype != SPACE_GRAPH; } -- 2.30.2 From f64a710839d31db9a91fdd51d3f7bab9c1453aa0 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 24 Aug 2023 12:21:37 +0200 Subject: [PATCH 3/4] implement review suggestions --- scripts/startup/bl_operators/geometry_nodes.py | 3 +++ source/blender/editors/screen/screen_ops.cc | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/startup/bl_operators/geometry_nodes.py b/scripts/startup/bl_operators/geometry_nodes.py index 776604cf397..204ffee388a 100644 --- a/scripts/startup/bl_operators/geometry_nodes.py +++ b/scripts/startup/bl_operators/geometry_nodes.py @@ -266,6 +266,9 @@ class NewGeometryNodeGroupTool(Operator): @classmethod def poll(cls, context): + if not context.space_data: + # Does not exist if the search menu is called while the cursor is outside the Blender window. + return False return context.space_data.type == 'NODE_EDITOR' and context.space_data.geometry_nodes_type == 'TOOL' def execute(self, context): diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 9e9d2314160..07dac59aae5 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -3241,12 +3241,9 @@ static bool keyframe_jump_poll(bContext *C) { /* There is a keyframe jump operator specifically for the Graph Editor. */ ScrArea *area = CTX_wm_area(C); - /* The area can be a nullptr when two main windows are open and you call the search menu on the - * non-active window. */ - if (area == nullptr) { - return ED_operator_screenactive_norender(C); - } - return ED_operator_screenactive_norender(C) && area->spacetype != SPACE_GRAPH; + /* The area can be a nullptr when the search menu is called while the cursor is outside the + * blender window. */ + return ED_operator_screenactive_norender(C) && (area && area->spacetype != SPACE_GRAPH); } static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) -- 2.30.2 From 2666a7d59a9448905ef3e51d6d2cbbfea49dd006 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 24 Aug 2023 12:28:49 +0200 Subject: [PATCH 4/4] got the bool logic wrong --- source/blender/editors/screen/screen_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 07dac59aae5..edae7a235ee 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -3243,7 +3243,7 @@ static bool keyframe_jump_poll(bContext *C) ScrArea *area = CTX_wm_area(C); /* The area can be a nullptr when the search menu is called while the cursor is outside the * blender window. */ - return ED_operator_screenactive_norender(C) && (area && area->spacetype != SPACE_GRAPH); + return ED_operator_screenactive_norender(C) && (!area || area->spacetype != SPACE_GRAPH); } static void SCREEN_OT_keyframe_jump(wmOperatorType *ot) -- 2.30.2