Do not leak MenuState.CurFrame in RestartMenu; bug #1156

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3768 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2012-02-12 20:46:54 +00:00
parent 38acc94022
commit 917cab1b7c
+6 -2
View File
@@ -60,8 +60,7 @@ DrawRestartMenuGraphic (MENU_STATE *pMS)
TEXT t; TEXT t;
UNICODE buf[64]; UNICODE buf[64];
s.frame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM)); s.frame = pMS->CurFrame;
pMS->CurFrame = s.frame;
GetFrameRect (s.frame, &r); GetFrameRect (s.frame, &r);
s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1; s.origin.x = (SCREEN_WIDTH - r.extent.width) >> 1;
s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1; s.origin.y = (SCREEN_HEIGHT - r.extent.height) >> 1;
@@ -300,6 +299,9 @@ RestartMenu (MENU_STATE *pMS)
SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut)); SleepThreadUntil (FadeScreen (FadeAllToBlack, TimeOut));
if (TimeOut == ONE_SECOND / 8) if (TimeOut == ONE_SECOND / 8)
SleepThread (ONE_SECOND * 3); SleepThread (ONE_SECOND * 3);
pMS->CurFrame = CaptureDrawable (LoadGraphic (RESTART_PMAP_ANIM));
DrawRestartMenuGraphic (pMS); DrawRestartMenuGraphic (pMS);
GLOBAL (CurrentActivity) &= ~CHECK_ABORT; GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT); SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
@@ -314,7 +316,9 @@ RestartMenu (MENU_STATE *pMS)
} }
Flash_terminate (pMS->flashContext); Flash_terminate (pMS->flashContext);
pMS->flashContext = 0;
DestroyDrawable (ReleaseDrawable (pMS->CurFrame)); DestroyDrawable (ReleaseDrawable (pMS->CurFrame));
pMS->CurFrame = 0;
if (GLOBAL (CurrentActivity) == (ACTIVITY)~0) if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
return (FALSE); // timed out return (FALSE); // timed out