Fixed crash in debugger's PrintGlyph() when restarting AppleII virtual machine

Fixed mem leaks for debugger's Font & Mem frame buffers
This commit is contained in:
tomcw 2020-06-28 10:18:59 +01:00
parent 60d54d6f3b
commit 9bf0cf98d4
3 changed files with 27 additions and 14 deletions

View File

@ -8843,11 +8843,7 @@ void DebugDestroy ()
}
// TODO: DataDisassembly_Clear()
DeleteObject( g_hConsoleBrushFG );
DeleteObject( g_hConsoleBrushBG );
DeleteDC( g_hConsoleFontDC );
DeleteObject( g_hConsoleFontBitmap );
ReleaseConsoleFontDC();
}

View File

@ -95,8 +95,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
char g_cConsoleBrushBG_g;
char g_cConsoleBrushBG_b;
HBRUSH g_hConsoleBrushFG = NULL;
HBRUSH g_hConsoleBrushBG = NULL;
static HBRUSH g_hConsoleBrushFG = NULL;
static HBRUSH g_hConsoleBrushBG = NULL;
// NOTE: Keep in sync ConsoleColors_e g_anConsoleColor !
COLORREF g_anConsoleColor[ NUM_CONSOLE_COLORS ] =
@ -593,8 +593,11 @@ void ReleaseDebuggerMemDC(void)
g_hDebuggerMemBM = NULL;
DeleteDC(g_hDebuggerMemDC);
g_hDebuggerMemDC = NULL;
FrameReleaseDC();
DeleteObject(g_pDebuggerMemFramebufferinfo);
VirtualFree(g_pDebuggerMemFramebufferinfo, 0, MEM_RELEASE);
g_pDebuggerMemFramebufferinfo = NULL;
g_pDebuggerMemFramebits = NULL;
}
}
@ -650,6 +653,26 @@ HDC GetConsoleFontDC(void)
return g_hConsoleFontDC;
}
void ReleaseConsoleFontDC(void)
{
if (g_hConsoleFontDC)
{
DeleteDC( g_hConsoleFontDC );
g_hConsoleFontDC = NULL;
DeleteObject( g_hConsoleFontBitmap );
g_hConsoleFontBitmap = NULL;
VirtualFree(g_hConsoleFontFramebufferinfo, 0, MEM_RELEASE);
g_hConsoleFontFramebufferinfo = NULL;
g_hConsoleFontFramebits = NULL;
}
DeleteObject( g_hConsoleBrushFG );
g_hConsoleBrushFG = NULL;
DeleteObject( g_hConsoleBrushBG );
g_hConsoleBrushBG = NULL;
}
void StretchBltMemToFrameDC(void)
{

View File

@ -25,12 +25,6 @@
CONSOLE_FONT_BITMAP_HEIGHT = CONSOLE_FONT_HEIGHT * CONSOLE_FONT_NUM_ROWS, // 128 pixels
};
extern HBRUSH g_hConsoleBrushFG;
extern HBRUSH g_hConsoleBrushBG;
extern HDC g_hConsoleFontDC;
extern HBITMAP g_hConsoleFontBitmap;
enum
{
DISPLAY_HEIGHT = 384,