2.5
Fix for crash on joining (previously splitted) areas. Reason was the stored regions in pushed 'spaces' not being copied. next: free running handlers on area join/split.
This commit is contained in:
@@ -108,10 +108,6 @@ typedef struct ARegionType {
|
||||
} ARegionType;
|
||||
|
||||
|
||||
void BKE_screen_area_free(struct ScrArea *sa);
|
||||
void BKE_area_region_free(struct ARegion *ar);
|
||||
void free_screen(struct bScreen *sc);
|
||||
|
||||
/* spacetypes */
|
||||
struct SpaceType *BKE_spacetype_from_id(int spaceid);
|
||||
const struct ListBase *BKE_spacetypes_list(void);
|
||||
@@ -122,5 +118,14 @@ void BKE_spacetypes_free(void); /* only for quitting blender */
|
||||
void BKE_spacedata_freelist(ListBase *lb);
|
||||
void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2);
|
||||
|
||||
/* area/regions */
|
||||
struct ARegion *BKE_area_region_copy(struct ARegion *ar);
|
||||
void BKE_area_region_free(struct ARegion *ar);
|
||||
|
||||
void BKE_screen_area_free(struct ScrArea *sa);
|
||||
|
||||
void free_screen(struct bScreen *sc);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -57,10 +57,9 @@ static void spacetype_free(SpaceType *st)
|
||||
|
||||
void BKE_spacetypes_free(void)
|
||||
{
|
||||
SpaceType *st, *stn;
|
||||
SpaceType *st;
|
||||
|
||||
for(st= spacetypes.first; st; st= stn) {
|
||||
stn= st->next;
|
||||
for(st= spacetypes.first; st; st= st->next) {
|
||||
spacetype_free(st);
|
||||
}
|
||||
|
||||
@@ -102,16 +101,14 @@ void BKE_spacetype_register(SpaceType *st)
|
||||
|
||||
void BKE_spacedata_freelist(ListBase *lb)
|
||||
{
|
||||
SpaceLink *sl, *sln;
|
||||
ARegion *ar, *arn;
|
||||
SpaceLink *sl;
|
||||
ARegion *ar;
|
||||
|
||||
for (sl= lb->first; sl; sl= sln) {
|
||||
for (sl= lb->first; sl; sl= sl->next) {
|
||||
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
|
||||
sln= sl->next;
|
||||
|
||||
/* regions for pushed spaces */
|
||||
for(ar=sl->regionbase.first; ar; ar=arn) {
|
||||
arn= ar->next;
|
||||
/* free regions for pushed spaces */
|
||||
for(ar=sl->regionbase.first; ar; ar=ar->next) {
|
||||
BKE_area_region_free(ar);
|
||||
}
|
||||
BLI_freelistN(&sl->regionbase);
|
||||
@@ -123,6 +120,37 @@ void BKE_spacedata_freelist(ListBase *lb)
|
||||
BLI_freelistN(lb);
|
||||
}
|
||||
|
||||
ARegion *BKE_area_region_copy(ARegion *ar)
|
||||
{
|
||||
ARegion *newar= MEM_dupallocN(ar);
|
||||
|
||||
newar->handlers.first= newar->handlers.last= NULL;
|
||||
newar->uiblocks.first= newar->uiblocks.last= NULL;
|
||||
newar->swinid= 0;
|
||||
|
||||
/* XXX regiondata callback */
|
||||
if(ar->regiondata)
|
||||
newar->regiondata= MEM_dupallocN(ar->regiondata);
|
||||
|
||||
return newar;
|
||||
}
|
||||
|
||||
|
||||
/* from lb2 to lb1, lb1 is supposed to be free'd */
|
||||
static void region_copylist(ListBase *lb1, ListBase *lb2)
|
||||
{
|
||||
ARegion *ar;
|
||||
|
||||
/* to be sure */
|
||||
lb1->first= lb1->last= NULL;
|
||||
|
||||
for(ar= lb2->first; ar; ar= ar->next) {
|
||||
ARegion *arnew= BKE_area_region_copy(ar);
|
||||
BLI_addtail(lb1, arnew);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* lb1 should be empty */
|
||||
void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
|
||||
{
|
||||
@@ -133,8 +161,13 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
|
||||
for (sl= lb2->first; sl; sl= sl->next) {
|
||||
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
|
||||
|
||||
if(st && st->duplicate)
|
||||
BLI_addtail(lb1, st->duplicate(sl));
|
||||
if(st && st->duplicate) {
|
||||
SpaceLink *slnew= st->duplicate(sl);
|
||||
|
||||
BLI_addtail(lb1, slnew);
|
||||
|
||||
region_copylist(&slnew->regionbase, &sl->regionbase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,6 @@ void ED_region_do_draw(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_exit(struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_pixelspace(const struct bContext *C, struct ARegion *ar);
|
||||
void ED_region_init(struct bContext *C, struct ARegion *ar);
|
||||
ARegion *ED_region_copy(ARegion *ar);
|
||||
|
||||
/* spaces */
|
||||
void ED_spacetypes_init(void);
|
||||
|
@@ -431,21 +431,6 @@ void ED_region_init(bContext *C, ARegion *ar)
|
||||
}
|
||||
|
||||
|
||||
ARegion *ED_region_copy(ARegion *ar)
|
||||
{
|
||||
ARegion *newar= MEM_dupallocN(ar);
|
||||
|
||||
newar->handlers.first= newar->handlers.last= NULL;
|
||||
newar->uiblocks.first= newar->uiblocks.last= NULL;
|
||||
newar->swinid= 0;
|
||||
|
||||
/* XXX regiondata */
|
||||
if(ar->regiondata)
|
||||
newar->regiondata= MEM_dupallocN(ar->regiondata);
|
||||
|
||||
return newar;
|
||||
}
|
||||
|
||||
/* sa2 to sa1, we swap spaces for fullscreen to keep all allocated data */
|
||||
/* area vertices were set */
|
||||
void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
|
||||
@@ -485,11 +470,11 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
|
||||
}
|
||||
}
|
||||
|
||||
/* regions */
|
||||
/* regions... XXX */
|
||||
BLI_freelistN(&sa1->regionbase);
|
||||
|
||||
for(ar= sa2->regionbase.first; ar; ar= ar->next) {
|
||||
ARegion *newar= ED_region_copy(ar);
|
||||
ARegion *newar= BKE_area_region_copy(ar);
|
||||
BLI_addtail(&sa1->regionbase, newar);
|
||||
}
|
||||
|
||||
|
@@ -1208,7 +1208,7 @@ void ED_SCR_OT_repeat_last(wmOperatorType *ot)
|
||||
/* insert a region in the area region list */
|
||||
static int region_split_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ARegion *newar= ED_region_copy(C->region);
|
||||
ARegion *newar= BKE_area_region_copy(C->region);
|
||||
int dir= RNA_enum_get(op->ptr, "dir");
|
||||
|
||||
BLI_insertlinkafter(&C->area->regionbase, C->region, newar);
|
||||
|
@@ -548,6 +548,10 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
|
||||
if(soutlinern->rnapath)
|
||||
soutlinern->rnapath= MEM_dupallocN(soutlinern->rnapath);
|
||||
|
||||
soutlinern->oops.first= soutlinern->oops.last= NULL;
|
||||
soutlinern->tree.first= soutlinern->tree.last= NULL;
|
||||
soutlinern->treestore= NULL;
|
||||
|
||||
return (SpaceLink *)soutlinern;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user