From da14738624117d54aa088a192e72b9270cdcf5d9 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 29 Jul 2009 18:15:46 +0000 Subject: 2.5 Two bugfixes, reported by Sebastian Skejo in IRC: - File operator poll wasn't secure, search for it crashed - Knife tool depends on having view3d context, fixed poll for it --- source/blender/editors/interface/interface_regions.c | 10 ++++++---- source/blender/editors/mesh/editmesh_loop.c | 2 +- source/blender/editors/space_file/file_ops.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 70716de6bdc..7cce7a0bbed 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -748,12 +748,14 @@ void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str) { uiSearchboxData *data= ar->regiondata; - data->items.autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but)); + if(str[0]) { + data->items.autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but)); - but->search_func(C, but->search_arg, but->editstr, &data->items); + but->search_func(C, but->search_arg, but->editstr, &data->items); - autocomplete_end(data->items.autocpl, str); - data->items.autocpl= NULL; + autocomplete_end(data->items.autocpl, str); + data->items.autocpl= NULL; + } } static void ui_searchbox_region_draw(const bContext *C, ARegion *ar) diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 7fc3753eefb..20fd33fc731 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -723,7 +723,7 @@ void MESH_OT_knife_cut(wmOperatorType *ot) ot->modal= WM_gesture_lines_modal; ot->exec= knife_cut_exec; - ot->poll= ED_operator_editmesh; + ot->poll= EM_view3d_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 65a46d6514d..a217dbe9f57 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -933,7 +933,7 @@ int file_delete_poll(bContext *C) SpaceFile *sfile= CTX_wm_space_file(C); struct direntry* file; - if (sfile->params) { + if (sfile && sfile->params) { if (sfile->params->active_file < 0) { poll= 0; } else { -- cgit v1.2.3