Fixed more crashers in screen/region/area/spacetype freeing code... 

Hint to Ton: watch how you're getting the pointer to the next item in the list when freeing the list ;)
This commit is contained in:
Joshua Leung 2008-12-14 11:39:00 +00:00
parent a3c77e4d9e
commit dcdca963b0

@ -57,10 +57,12 @@ static void spacetype_free(SpaceType *st)
void BKE_spacetypes_free(void)
{
SpaceType *st;
SpaceType *st, *stn;
for(st= spacetypes.first; st; st= st->next)
for(st= spacetypes.first; st; st= stn) {
stn= st->next;
spacetype_free(st);
}
BLI_freelistN(&spacetypes);
}
@ -100,17 +102,20 @@ void BKE_spacetype_register(SpaceType *st)
void BKE_spacedata_freelist(ListBase *lb)
{
SpaceLink *sl;
ARegion *ar;
SpaceLink *sl, *sln;
ARegion *ar, *arn;
for (sl= lb->first; sl; sl= sl->next) {
for (sl= lb->first; sl; sl= sln) {
SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
sln= sl->next;
if(st && st->free)
st->free(sl);
/* regions for pushed spaces */
for(ar=sl->regionbase.first; ar; ar=ar->next)
for(ar=sl->regionbase.first; ar; ar=arn) {
arn= ar->next;
BKE_area_region_free(ar);
}
BLI_freelistN(&sl->regionbase);
}