Page MenuHome

Crash after removing a "target" from any search button [e.g.UVMap node] and clicking again on the same button
Closed, DuplicatePublicBUG


System Information
Win 10

Blender Version
Broken: blender-2.83-a9963669f9d2-windows64
Worked: Not sure...

Short description of error
On nodes that have that "target" field (like the UVMap node etc), when you choose something from the list and then remove it by clicking on the (X) sign, if you don't move the mouse and click again on the same spot, blender crashes..

Exact steps for others to reproduce the error
In the shader editor, add a UVMap node, choose the uvmap in the "target" list, then remove it by clicking on (X). And without moving your mouse (or at least dont move it outside the button), click again on the same spot. Crash.
Double click on the (X) does the same thing..


Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Apr 3 2020, 10:25 AM
Philipp Oeser (lichtwerk) claimed this task.
Philipp Oeser (lichtwerk) changed the subtype of this task from "Report" to "Bug".

Confirmed, checking...

Philipp Oeser (lichtwerk) triaged this task as High priority.

Caused by rBc46dcdf8871e: UI: add menu search functionality to operator search menu

Since above commit, ui_apply_but_funcs_after will free the buttons search_arg
Then back and forth between restoring search_arg while drawing UI_but_func_search_set() and freeing again ui_apply_but_func()
Not really sure how to reliably ensure UI_but_func_search_set is called last...

So here, but->search_arg is NULL

1  ui_rna_collection_search_cb interface_utils.c         399   0x1617183 
2  ui_searchbox_update         interface_region_search.c 379   0x15fa734 
3  ui_textedit_begin           interface_handlers.c      3368  0x15b9759 
4  button_activate_state       interface_handlers.c      7850  0x15c69c8 
5  ui_do_but_TEX               interface_handlers.c      4393  0x15bbf37 
6  ui_do_but_SEARCH_UNLINK     interface_handlers.c      4421  0x15bc04d 
7  ui_do_button                interface_handlers.c      7553  0x15c5eec 
8  ui_handle_button_event      interface_handlers.c      8702  0x15c8941 
9  ui_region_handler           interface_handlers.c      10623 0x15cd137 
10 wm_handler_ui_call          wm_event_system.c         617   0xab73e0  
11 wm_handlers_do_intern       wm_event_system.c         2724  0xabca1c  
12 wm_handlers_do              wm_event_system.c         2835  0xabce41  
13 wm_event_do_handlers        wm_event_system.c         3304  0xabe40f  
14 WM_main                     wm.c                      447   0xab27fe  
15 main                        creator.c                 524   0x672a39

Crash could of course be prevented like so

3diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
4index a69837e9b51..c178fd5507b 100644
5--- a/source/blender/editors/interface/interface_utils.c
6+++ b/source/blender/editors/interface/interface_utils.c
7@@ -396,6 +396,12 @@ void ui_rna_collection_search_cb(const struct bContext *C,
8 {
9 uiRNACollectionSearch *data = arg;
10 char *name;
12+ if (data == NULL) {
13+ printf("%s: called with invalid but->search_arg\n", __func__);
14+ return;
15+ }
17 int i = 0, iconid = 0, flag = RNA_property_flag(data->target_prop);
18 ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
19 CollItemSearch *cis;

But I guess there are better ways to solve this, @Campbell Barton (campbellbarton), @Julian Eisel (Severin)?
Will set to Hig priority since it is a crash and it affects all search menus...

Philipp Oeser (lichtwerk) renamed this task from Crash after removing a "target" from a node and clicking again on the same spot to Crash after removing a "target" from any search button [e.g.UVMap node] and clicking again on the same button.Apr 3 2020, 2:13 PM
Philipp Oeser (lichtwerk) updated the task description. (Show Details)

Does not crash:
2.83 (sub 6), branch: master, commit date: 2020-03-09 13:47, hash: rB598ab525da3d
2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: rB375c7dc4caf4

2.83 (sub 11), branch: master, commit date: 2020-04-03 21:41, hash: rB7c0e28594840

thx investigating, we already know the commit that causes the issue (see above)

Ah, so that's the reason blender is crashing a lot lately.
Any news on a fix for this?