fix for a crash with the following steps.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Apr 2011 09:28:52 +0000 (09:28 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Apr 2011 09:28:52 +0000 (09:28 +0000)
- open file sel
- save user defaults
- new file
- ctrl+u (crash)

wasn't type checking the space file, passed info space to ED_fileselect_exit().

source/blender/editors/screen/screen_edit.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c

index a0a2ede11ef28ce12efa7b8c2f2324f2ece79227..e942cfc8b1fcd38702e78a1749e9eeb310e0212d 100644 (file)
@@ -1133,7 +1133,10 @@ void ED_area_exit(bContext *C, ScrArea *sa)
        ARegion *ar;
 
        if (sa->spacetype == SPACE_FILE) {
        ARegion *ar;
 
        if (sa->spacetype == SPACE_FILE) {
-               ED_fileselect_exit(C, (SpaceFile*)(sa) ? sa->spacedata.first : CTX_wm_space_data(C));
+               SpaceLink *sl= sa->spacedata.first;
+               if(sl && sl->spacetype == SPACE_FILE) {
+                       ED_fileselect_exit(C, (SpaceFile *)sl);
+               }
        }
 
        CTX_wm_area_set(C, sa);
        }
 
        CTX_wm_area_set(C, sa);
index 4eddeaaaf9f6352776ccb35d3ac0d5c701aaa7f9..5d786c1d00b3c1bb40228e0679a5809fd79ab4fe 100644 (file)
@@ -854,7 +854,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
                folderlist_popdir(sfile->folders_next, sfile->params->dir);
 
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
                folderlist_popdir(sfile->folders_next, sfile->params->dir);
 
-               // update folder_prev so we can check for it in folderlist_clear_next()
+               // update folders_prev so we can check for it in folderlist_clear_next()
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
                file_change_dir(C, 1);
                folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
 
                file_change_dir(C, 1);
index f815c7b4ac5c091956981c57a1e58695f7f9d600..0a8ae56c29198516d6e3d1f65dd5b534f7ecaffb 100644 (file)
@@ -469,13 +469,12 @@ int folderlist_clear_next(struct SpaceFile *sfile)
 /* not listbase itself */
 void folderlist_free(ListBase* folderlist)
 {
 /* not listbase itself */
 void folderlist_free(ListBase* folderlist)
 {
-       FolderList *folder;
        if (folderlist){
        if (folderlist){
+               FolderList *folder;
                for(folder= folderlist->first; folder; folder= folder->next)
                        MEM_freeN(folder->foldername);
                BLI_freelistN(folderlist);
        }
                for(folder= folderlist->first; folder; folder= folder->next)
                        MEM_freeN(folder->foldername);
                BLI_freelistN(folderlist);
        }
-       folderlist= NULL;
 }
 
 ListBase *folderlist_duplicate(ListBase* folderlist)
 }
 
 ListBase *folderlist_duplicate(ListBase* folderlist)
index 04fe2ebf828d76b6f14f9e4c3d48ce1903eee0f5..968953abf62e9ab0f4706f32da0b2d27e2660a2a 100644 (file)
@@ -655,9 +655,10 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
 void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
 {
        if(!sfile) return;
 void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
 {
        if(!sfile) return;
-       if(sfile->op)
+       if(sfile->op) {
                WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
                WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
-       sfile->op = NULL;
+               sfile->op = NULL;
+       }
 
        folderlist_free(sfile->folders_prev);
        folderlist_free(sfile->folders_next);
 
        folderlist_free(sfile->folders_prev);
        folderlist_free(sfile->folders_next);