From 081f1880ea898bba1bfd2ba2ff79b5e4de929b86 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 31 Aug 2015 05:57:41 +0000 Subject: Toaster: fixed memleak, added CoInitialize call git-svn-id: http://svn.miranda-ng.org/main/trunk@15123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Toaster/src/main.cpp | 5 +++++ plugins/Toaster/src/services.cpp | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index 72fe21d1fc..39f4c549b7 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -40,6 +40,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + + CoInitialize(NULL); + HookEvent(ME_SYSTEM_PRESHUTDOWN, &OnPreShutdown); InitServices(); @@ -56,6 +59,8 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { + CoUninitialize(); + return 0; } diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 3369a2ffb8..689dabae4a 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -104,11 +104,13 @@ static void ShowToastNotification(TCHAR* text, TCHAR* title, MCONTACT hContact) } else { -#ifdef _DEBUG + OutputDebugStringA(CMStringA(FORMAT, "Toaster error: HRESULT = %lld", hr)); +#ifdef _DEBUG DebugBreak(); #else Netlib_Logf(NULL, "Toaster: " __FUNCTION__ " failed: HRESULT = %lld", hr); #endif + delete arg->notification; } } -- cgit v1.2.3