diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-09-16 00:47:34 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-09-16 00:47:34 +0400 |
commit | 063d806f152e003b662a0e22a19c27a4afbfb7fa (patch) | |
tree | 8af7c0a845b488c2ed3eea89b9e32a1556aa479f | |
parent | 22274d38079f7e1e1e0bf24e777c333961ed18f7 (diff) |
2.5 filebrowser
bugfix #1: SpaceFile->files needs to be deleted on exec and cancel of the filebrowser and in init to ensure correct setting of the read function.
bugfix #2: SpaceFile->params needs to be set in file_init otherwise Python can't access params in header ui.
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index d2d1d11ec5c..0e0ad88906e 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -496,6 +496,12 @@ int file_cancel_exec(bContext *C, wmOperator *unused) WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_CANCEL); sfile->op = NULL; + if (sfile->files) { + filelist_free(sfile->files); + MEM_freeN(sfile->files); + sfile->files= NULL; + } + return OPERATOR_FINISHED; } @@ -567,6 +573,10 @@ int file_exec(bContext *C, wmOperator *unused) BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs"); fsmenu_write_file(fsmenu_get(), name); WM_event_fileselect_event(C, op, EVT_FILESELECT_EXEC); + + filelist_free(sfile->files); + 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 085eecd2a7d..a0787ef989d 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -169,18 +169,13 @@ short ED_fileselect_set_params(SpaceFile *sfile) } else { /* default values, if no operator */ + params->type = FILE_UNIX; params->flag |= FILE_HIDE_DOT; params->display = FILE_SHORTDISPLAY; params->filter = 0; params->sort = FILE_SORT_ALPHA; } - /* new params, refresh file list */ - if(sfile->files) { - filelist_free(sfile->files); - filelist_setdir(sfile->files, params->dir); - } - return 1; } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 68eeb8718a2..27948618d03 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -159,6 +159,12 @@ static void file_init(struct wmWindowManager *wm, ScrArea *sa) if(sfile->params) { MEM_freeN(sfile->params); sfile->params = 0; + ED_fileselect_set_params(sfile); + if (sfile->files) { + filelist_free(sfile->files); + MEM_freeN(sfile->files); + sfile->files= NULL; + } } printf("file_init\n"); } |