fix for a crash with the following steps.

- 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().
This commit is contained in:
Campbell Barton
2011-04-25 09:28:52 +00:00
parent bd80f19c22
commit 16ba377026
4 changed files with 9 additions and 6 deletions

View File

@@ -1133,7 +1133,10 @@ void ED_area_exit(bContext *C, ScrArea *sa)
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);

View 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);
// 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);

View File

@@ -469,13 +469,12 @@ int folderlist_clear_next(struct SpaceFile *sfile)
/* not listbase itself */
void folderlist_free(ListBase* folderlist)
{
FolderList *folder;
if (folderlist){
FolderList *folder;
for(folder= folderlist->first; folder; folder= folder->next)
MEM_freeN(folder->foldername);
BLI_freelistN(folderlist);
}
folderlist= NULL;
}
ListBase *folderlist_duplicate(ListBase* folderlist)

View 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;
if(sfile->op)
if(sfile->op) {
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);