diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2010-09-18 02:12:23 +0400 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2010-09-18 02:12:23 +0400 |
commit | a06c46d8dd552a651c90f0ca9805bfbba04cb193 (patch) | |
tree | 93c6dd1140ead737eb683d74a22c668cfb8f7025 /source | |
parent | b4a4c330540deeb7ea9e5f749e9fbf0768731b68 (diff) |
Apply patch [#23846] Fix for [#23698] in File Browser system. Properly removes handler and sfile when File selector disapears.
Patch by Alexander Kuznetsov
Reported by Chidozie Oku
From patch description:
"
Handler is now released on every exit from File Selector. For example pressing ctrl-up and then changing editor type
to another also releases the handler.
When an area is changed from SPACE_FILE, ED_fileselect_exit is called for clean up. It takes function of freeing folder
list and files (before it was done in cancel or exec functions) because they must be released on every exit anyway.
op!=null means cancel or exec was not executed so a handler was not released. ED_fileselect_exit then releases the handler
without changing screens.
"
Thanks!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/area.c | 7 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 15 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 16 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_event_types.h | 9 |
6 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 90f9d5683c2..07d1e47f74e 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1095,13 +1095,6 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) { SpaceLink *sl = (sa) ? sa->spacedata.first : CTX_wm_space_data(C); - /* Special handling of filebrowser to stop background thread for - thumbnail creation - don't want to waste cpu resources if not showing - the filebrowser */ - if (sl->spacetype == SPACE_FILE) { - ED_fileselect_exit(C, (SpaceFile*)sl); - } - if(sl->next) { /* workaround for case of double prevspace, render window with a file browser on top of it */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 2aceabcea76..1ca8bff3193 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1090,6 +1090,10 @@ void ED_area_exit(bContext *C, ScrArea *sa) ScrArea *prevsa= CTX_wm_area(C); ARegion *ar; + if (sa->spacetype == SPACE_FILE) { + ED_fileselect_exit(C, (SpaceFile*)(sa) ? sa->spacedata.first : CTX_wm_space_data(C)); + } + CTX_wm_area_set(C, sa); for(ar= sa->regionbase.first; ar; ar= ar->next) ED_region_exit(C, ar); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 9393f1c4d6d..7888fdeef8a 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -507,18 +507,11 @@ void FILE_OT_highlight(struct wmOperatorType *ot) int file_cancel_exec(bContext *C, wmOperator *unused) { SpaceFile *sfile= CTX_wm_space_file(C); - - folderlist_free(sfile->folders_prev); - folderlist_free(sfile->folders_next); - - WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_CANCEL); - sfile->op = NULL; + wmOperator *op = sfile->op; - if (sfile->files) { - ED_fileselect_clear(C, sfile); - MEM_freeN(sfile->files); - sfile->files= NULL; - } + sfile->op = NULL; + + WM_event_fileselect_event(C, op, EVT_FILESELECT_CANCEL); return OPERATOR_FINISHED; } @@ -686,17 +679,11 @@ int file_exec(bContext *C, wmOperator *exec_op) file_sfile_to_operator(op, sfile, filepath); - folderlist_free(sfile->folders_prev); - folderlist_free(sfile->folders_next); - fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1); BLI_make_file_string(G.sce, filepath, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu_get(), filepath); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); - ED_fileselect_clear(C, sfile); - MEM_freeN(sfile->files); - sfile->files= NULL; } return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 52d59270663..e2099be6f03 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -531,5 +531,18 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile) void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile) { - thumbnails_stop(sfile->files, C); + if(!sfile) return; + if(sfile->op) + WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL); + sfile->op = NULL; + + folderlist_free(sfile->folders_prev); + folderlist_free(sfile->folders_next); + + if (sfile->files) { + ED_fileselect_clear(C, sfile); + MEM_freeN(sfile->files); + sfile->files= NULL; + } + } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c32fb372ffd..9e7606a9f14 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1224,18 +1224,20 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa case EVT_FILESELECT_EXEC: case EVT_FILESELECT_CANCEL: + case EVT_FILESELECT_EXTERNAL_CANCEL: { /* XXX validate area and region? */ bScreen *screen= CTX_wm_screen(C); - - if(screen != handler->filescreen) - ED_screen_full_prevspace(C, CTX_wm_area(C)); - else - ED_area_prevspace(C, CTX_wm_area(C)); - - /* remlink now, for load file case */ + + /* remlink now, for load file case before removing*/ BLI_remlink(handlers, handler); + if(event->val!=EVT_FILESELECT_EXTERNAL_CANCEL) + if(screen != handler->filescreen) + ED_screen_full_prevspace(C, CTX_wm_area(C)); + else + ED_area_prevspace(C, CTX_wm_area(C)); + wm_handler_op_context(C, handler); /* needed for uiPupMenuReports */ diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 6cb3971bd21..e4b56080b03 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -269,10 +269,11 @@ #define EVT_FILESELECT 0x5020 /* event->val */ -#define EVT_FILESELECT_OPEN 1 -#define EVT_FILESELECT_FULL_OPEN 2 -#define EVT_FILESELECT_EXEC 3 -#define EVT_FILESELECT_CANCEL 4 +#define EVT_FILESELECT_OPEN 1 +#define EVT_FILESELECT_FULL_OPEN 2 +#define EVT_FILESELECT_EXEC 3 +#define EVT_FILESELECT_CANCEL 4 +#define EVT_FILESELECT_EXTERNAL_CANCEL 5 /* event->type */ #define EVT_BUT_OPEN 0x5021 |