2.5
authorTon Roosendaal <ton@blender.org>
Sun, 14 Dec 2008 17:48:52 +0000 (17:48 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 14 Dec 2008 17:48:52 +0000 (17:48 +0000)
And area-joining is memory-error free again!

source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/screen/screen_ops.c

index 3af5ac2652cd7eac5dc3dc48a5b7335e4ec0c43e..e74e1e113fd02f872b910a9b0918c2ef20e550a8 100644 (file)
@@ -252,10 +252,13 @@ static ScrArea *screen_addarea(bScreen *sc, ScrVert *v1, ScrVert *v2, ScrVert *v
        return sa;
 }
 
-static void screen_delarea(bScreen *sc, ScrArea *sa)
+static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa)
 {
-       /* XXX need context to cancel operators ED_area_exit(C, sa); */
+       
+       ED_area_exit(C, sa);
+       
        BKE_screen_area_free(sa);
+       
        BLI_remlink(&sc->areabase, sa);
        MEM_freeN(sa);
 }
@@ -475,7 +478,7 @@ int area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb)
 /* Helper function to join 2 areas, it has a return value, 0=failed 1=success
 *      used by the split, join operators
 */
-int screen_area_join(bScreen* scr, ScrArea *sa1, ScrArea *sa2) 
+int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) 
 {
        int dir;
        
@@ -514,7 +517,7 @@ int screen_area_join(bScreen* scr, ScrArea *sa1, ScrArea *sa2)
                screen_addedge(scr, sa1->v3, sa1->v4);
        }
        
-       screen_delarea(scr, sa2);
+       screen_delarea(C, scr, sa2);
        removedouble_scrverts(scr);
        sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
        
@@ -567,7 +570,7 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
 static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 {
        ScrVert *sv=NULL;
-       ScrArea *sa, *san;
+       ScrArea *sa;
        int sizex, sizey;
        float facx, facy, tempf, min[2], max[2];
        
@@ -616,11 +619,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
        }
        
        /* test for collapsed areas. This could happen in some blender version... */
-       for(sa= sc->areabase.first; sa; sa= san) {
-               san= sa->next;
-               if(sa->v1==sa->v2 || sa->v3==sa->v4 || sa->v2==sa->v3)
-                       screen_delarea(sc, sa);
-       }
+       /* ton: removed option now, it needs Context... */
        
        /* make each window at least HEADERY high */
        for(sa= sc->areabase.first; sa; sa= sa->next) {
index 7b44b1910c77c4b5aedab2a919564ddd39a742e5..d228748d8736fd588e30c045d7095806c11ff622 100644 (file)
@@ -38,7 +38,7 @@ void          area_copy_data  (ScrArea *sa1, ScrArea *sa2, int swap_space);
 bScreen                *screen_add(struct wmWindow *win, char *name);
 ScrEdge                *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2);
 ScrArea                *area_split(wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac);
-int                    screen_area_join(bScreen* scr, ScrArea *sa1, ScrArea *sa2);
+int                    screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2);
 int                    area_getorientation(bScreen *screen, ScrArea *sa, ScrArea *sb);
 void           select_connected_scredge(bScreen *sc, ScrEdge *edge);
 
index 9a96edf243c31deb9cc09b23eff4d58f98a16b6a..db8ef82a5b0124dcae0a9c6b8ee2715f1125ed1f 100644 (file)
@@ -823,7 +823,7 @@ static int area_split_cancel(bContext *C, wmOperator *op)
 {
        sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
 
-       if (screen_area_join(C->screen,sd->sarea, sd->narea)) {
+       if (screen_area_join(C, C->screen, sd->sarea, sd->narea)) {
                if (C->area == sd->narea) {
                        C->area = NULL;
                }
@@ -975,7 +975,7 @@ static int area_join_apply(bContext *C, wmOperator *op)
        sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
        if (!jd) return 0;
 
-       if(!screen_area_join(C->screen,jd->sa1,jd->sa2)){
+       if(!screen_area_join(C, C->screen, jd->sa1, jd->sa2)){
                return 0;
        }
        if (C->area == jd->sa2) {