From 58305edc8b62b3de0a75955e413bfc8136570805 Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 24 Nov 2018 13:17:37 +1030 Subject: [PATCH] [Video] Make sure to close trace --- Source/Project64-video/Main.cpp | 1 + Source/Project64-video/ScreenResolution.cpp | 2 +- Source/Project64-video/trace.cpp | 12 +++++++++++- Source/Project64-video/trace.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Source/Project64-video/Main.cpp b/Source/Project64-video/Main.cpp index bf487d150..10b911ce2 100644 --- a/Source/Project64-video/Main.cpp +++ b/Source/Project64-video/Main.cpp @@ -675,6 +675,7 @@ void CALL CloseDLL(void) voodoo.gamma_table_g = 0; delete[] voodoo.gamma_table_b; voodoo.gamma_table_b = 0; + StopTrace(); } /****************************************************************** diff --git a/Source/Project64-video/ScreenResolution.cpp b/Source/Project64-video/ScreenResolution.cpp index aa03fc455..5f82ac243 100644 --- a/Source/Project64-video/ScreenResolution.cpp +++ b/Source/Project64-video/ScreenResolution.cpp @@ -270,7 +270,7 @@ void FullScreenResolutions::init() int current = 0; char smode[256]; memset(&enumMode, 0, sizeof(DEVMODE)); - memset(&prevInfo, 0, sizeof(ResolutionInfo)); + prevInfo = ResolutionInfo(); while (EnumDisplaySettings(NULL, iModeNum++, &enumMode) != 0) { ResolutionInfo curInfo(NULL, enumMode.dmPelsWidth, enumMode.dmPelsHeight, enumMode.dmDisplayFrequency); diff --git a/Source/Project64-video/trace.cpp b/Source/Project64-video/trace.cpp index 20c5ef362..66931bf07 100644 --- a/Source/Project64-video/trace.cpp +++ b/Source/Project64-video/trace.cpp @@ -96,4 +96,14 @@ void StartTrace(void) } g_LogFile = new CTraceFileLog(LogFilePath, g_settings->FlushLogs(), CLog::Log_New, 500); TraceAddModule(g_LogFile); -} \ No newline at end of file +} + +void StopTrace(void) +{ + if (g_LogFile) + { + TraceRemoveModule(g_LogFile); + delete g_LogFile; + g_LogFile = NULL; + } +} diff --git a/Source/Project64-video/trace.h b/Source/Project64-video/trace.h index f947b2036..4dc2f6789 100644 --- a/Source/Project64-video/trace.h +++ b/Source/Project64-video/trace.h @@ -30,3 +30,4 @@ enum TraceModuleGlide64 void SetupTrace(void); void StartTrace(void); +void StopTrace(void);