From dcdca963b0745c56f5148202f734c0587ace8133 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 14 Dec 2008 11:39:00 +0000 Subject: [PATCH] 2.5: 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 ;) --- source/blender/blenkernel/intern/screen.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index c7379f61870..f4c5ea1ea5e 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -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); }