[Bf-blender-cvs] [a631dc55756] blender-v3.3-release: Fix T100731: Keymap Editor context menu crash

Philipp Oeser noreply at git.blender.org
Sat Sep 3 11:42:21 CEST 2022


Commit: a631dc55756b9c1a9835bf5b06f5d57f388f1277
Author: Philipp Oeser
Date:   Thu Sep 1 10:52:15 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBa631dc55756b9c1a9835bf5b06f5d57f388f1277

Fix T100731: Keymap Editor context menu crash

Caused by {rB3f3d82cfe9ce}

Since above commit, a `uiRNACollectionSearch` may contain a NULL
`search_prop`, crashing the menu entry for "Jump To Target"
(`ui_jump_to_target_button_poll`).

Now safeguard against this with a NULL check (getting search callbacks
to work for "Jump To Target" can be investigated in master).

Maniphest Tasks: T100731

Differential Revision: https://developer.blender.org/D15832

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

M	source/blender/editors/interface/interface_ops.c

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

diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 865aed01aa1..7a7496fb071 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1566,8 +1566,13 @@ static bool jump_to_target_button(bContext *C, bool poll)
         char str_buf[MAXBONENAME];
         char *str_ptr = RNA_property_string_get_alloc(&ptr, prop, str_buf, sizeof(str_buf), NULL);
 
-        int found = RNA_property_collection_lookup_string(
-            &coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr);
+        int found = 0;
+        /* Jump to target only works with search properties currently, not search callbacks yet.
+         * See ui_but_add_search. */
+        if (coll_search->search_prop != NULL) {
+          found = RNA_property_collection_lookup_string(
+              &coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr);
+        }
 
         if (str_ptr != str_buf) {
           MEM_freeN(str_ptr);



More information about the Bf-blender-cvs mailing list