fix for crash opening the file selector twice with multiple windows open (when the...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 6 Jun 2011 00:42:36 +0000 (00:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 6 Jun 2011 00:42:36 +0000 (00:42 +0000)
source/blender/blenloader/intern/readfile.c
source/blender/editors/include/ED_screen.h
source/blender/editors/render/render_view.c
source/blender/editors/screen/screen_edit.c
source/blender/windowmanager/intern/wm_event_system.c

index a01b8b58c82be134208b0f0c0b36ebdf7dd9e524..6f0400d5764f58a9cd2c5e2766916742bd7df674 100644 (file)
@@ -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]);
                                }
index 6e396a1021b232a3a6c27463a146b82efbb0b9ba..f2ef4e16852b4454a8e7fa73fa38b54ecdd3a23f 100644 (file)
@@ -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);
index 64a4d47cddc92d8cf56af09b4b20b7fd82e6ac3e..9dfcde6ed0db9ba170ca46ca5762deef71dd6450 100644 (file)
@@ -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) {
index eb41dcd147beb8e94b073953ac528259c04bdc23..721ce82335191ee5ead55307c178aa0d85643aa5 100644 (file)
@@ -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)
index 615259bda15dc3ebf1e26f4720b0a03ba410e4a3..7bd5fd7e7dfbb1d10ba5423d7fbb30f157b3bf88 100644 (file)
@@ -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;