diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2017-05-13 20:48:04 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2017-05-13 20:48:04 +0300 |
commit | 77a90f7666bf6eb78b8f22ab4abae300aae10ef9 (patch) | |
tree | ea0b49117ac4e3b6370f65b92f3fcccd697c337d /source/blender | |
parent | 2d22092230d70586543970d47afc2f9a51a8304f (diff) |
Fix crash when using template_search with non-ID data
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index f2e79ec0c7f..f383719a747 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -214,11 +214,12 @@ int uiDefAutoButsRNA( return tot; } + /* *** RNA collection search menu *** */ typedef struct CollItemSearch { struct CollItemSearch *next, *prev; - ID *id; + void *data; char *name; int index; int iconid; @@ -247,7 +248,6 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char /* build a temporary list of relevant items first */ RNA_PROP_BEGIN (&data->search_ptr, itemptr, data->search_prop) { - ID *id = NULL; if (flag & PROP_ID_SELF_CHECK) if (itemptr.data == data->target_ptr.id.data) @@ -262,14 +262,13 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */ iconid = 0; if (itemptr.type && RNA_struct_is_ID(itemptr.type)) { - id = itemptr.data; - iconid = ui_id_icon_get(C, id, false); + iconid = ui_id_icon_get(C, itemptr.data, false); } if (name) { if (skip_filter || BLI_strcasestr(name, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); - cis->id = id; + cis->data = itemptr.data; cis->name = MEM_dupallocN(name); cis->index = i; cis->iconid = iconid; @@ -286,8 +285,7 @@ void ui_rna_collection_search_cb(const struct bContext *C, void *arg, const char /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { - void *poin = cis->id ? cis->id : SET_INT_IN_POINTER(cis->index); - if (UI_search_item_add(items, cis->name, poin, cis->iconid) == false) { + if (UI_search_item_add(items, cis->name, cis->data, cis->iconid) == false) { break; } } |