2.5 - Fixed crashes when closing windows

This commit is contained in:
2008-12-11 23:05:18 +00:00
parent b7426ab4e2
commit 6f6eee0923
2 changed files with 14 additions and 6 deletions

View File

@@ -164,15 +164,19 @@ void BKE_screen_area_free(ScrArea *sa)
/* don't free screen itself */
void free_screen(bScreen *sc)
{
ScrArea *sa;
ARegion *ar;
ScrArea *sa, *san;
ARegion *ar, *arn;
for(ar=sc->regionbase.first; ar; ar=ar->next)
for(ar=sc->regionbase.first; ar; ar=arn) {
arn= ar->next;
BKE_area_region_free(ar);
}
BLI_freelistN(&sc->regionbase);
for(sa= sc->areabase.first; sa; sa= sa->next)
for(sa= sc->areabase.first; sa; sa= san) {
san= sa->next;
BKE_screen_area_free(sa);
}
BLI_freelistN(&sc->vertbase);
BLI_freelistN(&sc->edgebase);

View File

@@ -3530,17 +3530,21 @@ static int ui_handler_region(bContext *C, wmEvent *event)
static void ui_handler_remove_region(bContext *C)
{
bScreen *sc;
ARegion *ar;
ar= C->region;
if(ar==NULL) return;
if(ar == NULL) return;
uiFreeBlocks(C, &ar->uiblocks);
sc= C->screen;
if(sc == NULL) return;
/* delayed apply callbacks, but not for screen level regions, those
* we rather do at the very end after closing them all, which will
* be done in ui_handler_region/window */
if(BLI_findindex(&C->screen->regionbase, ar) == -1)
if(BLI_findindex(&sc->regionbase, ar) == -1)
ui_apply_but_funcs_after(C);
}