diff options
author | George Hazan <ghazan@miranda.im> | 2021-05-04 20:42:25 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-05-04 20:42:25 +0300 |
commit | 68c7bf3b55ca132143686ab433659c3b828760aa (patch) | |
tree | 5e2b5f5bc674f05a4c351a8f4f0ea6b6e596ca16 /plugins/Console/src | |
parent | ef6ef30fac86de58bfd7d52b1d8a213b8d955d5d (diff) |
attempt to fix some problems on exit
Diffstat (limited to 'plugins/Console/src')
-rw-r--r-- | plugins/Console/src/Console.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index cb19571c36..6bf70f4454 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -894,6 +894,7 @@ static INT_PTR CALLBACK ConsoleDlgProc(HWND hwndDlg, UINT message, WPARAM wParam void __cdecl ConsoleThread(void*)
{
+ MThreadHandle threadLock(hConsoleThread);
CoInitialize(nullptr);
HWND hwnd = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CONSOLE), nullptr, ConsoleDlgProc);
@@ -1211,7 +1212,7 @@ void InitConsole() LoadSettings();
- hConsoleThread = mir_forkthread(ConsoleThread);
+ mir_forkthread(ConsoleThread);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreshutdownConsole);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
@@ -1225,15 +1226,17 @@ void ShutdownConsole(void) List_Destroy(&lModules);
- if (gImg) ImageList_Destroy(gImg);
+ if (gImg)
+ ImageList_Destroy(gImg);
- for (i = 0; i < _countof(hIcons); i++) {
- if (hIcons[i]) DestroyIcon(hIcons[i]);
- }
+ for (i = 0; i < _countof(hIcons); i++)
+ if (hIcons[i])
+ DestroyIcon(hIcons[i]);
if (hwndConsole)
EndDialog(hwndConsole, TRUE);
- WaitForSingleObject(hConsoleThread, INFINITE);
+ if (hConsoleThread)
+ WaitForSingleObject(hConsoleThread, INFINITE);
}
////////////////////////////////////////////////////////////////////////////////
|