Fix: crash using tab in attribute search

The crash happens when hitting tab while using attribute search in the Geometry
Nodes modifier. This triggers some auto-completion code (which doesn't work here
currently, but that's potentially a separate problem). However, the
auto-completion code did not handle the case when the string that's
auto-completed does not have a maximum length, i.e. it is dynamic.

This patch adds some handling for the case when the auto-completed string
storage has a dynamic size.

Pull Request: https://projects.blender.org/blender/blender/pulls/141200
This commit is contained in:
Jacques Lucke
2025-07-02 06:22:34 +02:00
parent 531bc5ca69
commit 0596c7f119

View File

@@ -596,7 +596,12 @@ int ui_searchbox_autocomplete(bContext *C, ARegion *region, uiBut *but, char *st
BLI_assert(but->type == UI_BTYPE_SEARCH_MENU);
if (str[0]) {
data->items.autocpl = UI_autocomplete_begin(str, ui_but_string_get_maxncpy(but));
int maxncpy = ui_but_string_get_maxncpy(but);
if (maxncpy == 0) {
/* The string length is dynamic, just assume a reasonable length. */
maxncpy = strlen(str) + 1024;
}
data->items.autocpl = UI_autocomplete_begin(str, maxncpy);
ui_searchbox_update_fn(C, search_but, but->editstr, &data->items);