fix for crash opening the file selector twice with multiple windows open (when the mouse was over the inactive window).

This commit is contained in:
Campbell Barton 2011-06-06 00:42:36 +00:00
parent 7da45bcbcb
commit e4bb5403d3
5 changed files with 19 additions and 13 deletions

@ -1738,7 +1738,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list)
data->coefficients= newdataadr(fd, data->coefficients);
if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
unsigned a;
unsigned int a;
for(a = 0; a < data->arraysize; a++)
SWITCH_INT(data->coefficients[a]);
}

@ -107,7 +107,7 @@ void ED_screen_set_subwinactive(struct bContext *C, struct wmEvent *event);
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh);
int ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
void ED_screen_full_restore(struct bContext *C, ScrArea *sa);
struct ScrArea *ED_screen_full_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa);

@ -184,8 +184,7 @@ void render_view_open(bContext *C, int mx, int my)
area_was_image = 1;
/* this function returns with changed context */
ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
sa= CTX_wm_area(C);
sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
}
if(!sa) {

@ -1513,7 +1513,7 @@ void ED_screen_delete_scene(bContext *C, Scene *scene)
unlink_scene(bmain, scene, newscene);
}
int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
{
wmWindow *win= CTX_wm_window(C);
bScreen *screen= CTX_wm_screen(C);
@ -1538,7 +1538,7 @@ int ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
ED_area_newspace(C, newsa, type);
return 1;
return newsa;
}
void ED_screen_full_prevspace(bContext *C, ScrArea *sa)

@ -1289,16 +1289,23 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
if (handler->op_area == NULL) {
bScreen *screen = CTX_wm_screen(C);
sa = (ScrArea *)screen->areabase.first;
} else
}
else {
sa = handler->op_area;
}
if(event->val==EVT_FILESELECT_OPEN)
ED_area_newspace(C, sa, SPACE_FILE);
else
ED_screen_full_newspace(C, sa, SPACE_FILE); /* sets context */
if(event->val==EVT_FILESELECT_OPEN) {
ED_area_newspace(C, sa, SPACE_FILE); /* 'sa' is modified in-place */
}
else {
sa= ED_screen_full_newspace(C, sa, SPACE_FILE); /* sets context */
}
/* note, getting the 'sa' back from the context causes a nasty bug where the newly created
* 'sa' != CTX_wm_area(C). removed the line below and set 'sa' in the 'if' above */
/* sa = CTX_wm_area(C); */
/* settings for filebrowser, sfile is not operator owner but sends events */
sa = CTX_wm_area(C);
sfile= (SpaceFile*)sa->spacedata.first;
sfile->op= handler->op;