diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-01 11:50:43 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-01 11:50:43 +0000 |
commit | 4b2a0c3b6959c5691152af85b726b0f6a9398d3a (patch) | |
tree | eaf1c55b1e614ffbf5eaf06a35cc3c8a75c2e17b /plugins | |
parent | 5a28a5996189fe3771799388ead1e26e64062494 (diff) |
Toster: leaks fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@15133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Toaster/src/services.cpp | 2 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_event_handler.cpp | 7 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 17 |
3 files changed, 14 insertions, 12 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 80bc0c85fe..501d6a8253 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -22,7 +22,6 @@ wchar_t* SaveBitmap(HBITMAP bmp, const char *szId) isi.fif = FREE_IMAGE_FORMAT::FIF_PNG;
CallService(MS_IMG_SAVE, (WPARAM)&isi, IMGL_WCHAR);
}
-
return mir_wstrdup(wszSavePath);
}
@@ -119,6 +118,7 @@ void __stdcall ShowToastNotification(void* p) else
{
delete arg->notification;
+ mir_free(arg);
}
}
diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp index 51689bab3e..49e3105dbc 100644 --- a/plugins/Toaster/src/toast_event_handler.cpp +++ b/plugins/Toaster/src/toast_event_handler.cpp @@ -1,6 +1,7 @@ #include "stdafx.h"
using namespace ABI::Windows::UI::Notifications;
+using namespace Microsoft::WRL;
ToastEventHandler::ToastEventHandler() : _ref(1), _callback(nullptr), _arg(nullptr)
{
@@ -47,7 +48,7 @@ IFACEMETHODIMP ToastEventHandler::QueryInterface(_In_ REFIID riid, _COM_Outptr_ return E_NOINTERFACE;
}
-IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IInspectable* /* args */)
+IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification *sender, _In_ IInspectable* args)
{
if (_callback != nullptr)
_callback(_arg);
@@ -58,7 +59,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, return S_OK;
}
-IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastDismissedEventArgs* /* e */)
+IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastDismissedEventArgs* /*e*/)
{
callbackArg *cb = (callbackArg*)_arg;
mir_cslock lck(csNotifications);
@@ -66,7 +67,7 @@ IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, return S_OK;
}
-IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastFailedEventArgs* /* e */)
+IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification* /* sender */, _In_ IToastFailedEventArgs* /*e*/ )
{
callbackArg *cb = (callbackArg*)_arg;
mir_cslock lck(csNotifications);
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index 941bacbefc..7128bce13b 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -22,23 +22,23 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml {
ComPtr<ABI::Windows::Data::Xml::Dom::IXmlDocumentIO> xmlDocument;
CHECKHR(Windows::Foundation::ActivateInstance(StringReferenceWrapper(RuntimeClass_Windows_Data_Xml_Dom_XmlDocument).Get(), &xmlDocument));
-
HXML xmlToast = xmlCreateNode(L"toast", NULL, 0);
+
HXML xmlAudioNode = xmlAddChild(xmlToast, L"audio", NULL);
xmlAddAttr(xmlAudioNode, L"silent", L"true");
+
HXML xmlVisualNode = xmlAddChild(xmlToast, L"visual", NULL);
+
HXML xmlBindingNode = xmlAddChild(xmlVisualNode, L"binding", NULL);
+ xmlAddAttr(xmlBindingNode, L"template", L"ToastGeneric");
if (_imagePath)
{
- xmlAddAttr(xmlBindingNode, L"template", L"ToastImageAndText02");
HXML xmlImageNode = xmlAddChild(xmlBindingNode, L"image", NULL);
+ xmlAddAttr(xmlImageNode, L"placement", L"appLogoOverride");
xmlAddAttr(xmlImageNode, L"id", L"1");
xmlAddAttr(xmlImageNode, L"src", CMStringW(FORMAT, L"file:///%s", _imagePath));
}
- else
- {
- xmlAddAttr(xmlBindingNode, L"template", L"ToastText02");
- }
+
HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != NULL ? _caption : L"Miranda NG");
xmlAddAttr(xmlTitleNode, L"id", L"1");
if (_text)
@@ -46,10 +46,12 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml HXML xmlTextNode = xmlAddChild(xmlBindingNode, L"text", _text);
xmlAddAttr(xmlTextNode, L"id", L"2");
}
-
+
TCHAR *xtmp = xmlToString(xmlToast, NULL);
size_t xlen = mir_tstrlen(xtmp);
+ xmlDestroyNode(xmlToast);
+
CHECKHR(xmlDocument->LoadXml(StringReferenceWrapper(xtmp, xlen).Get()));
return xmlDocument.CopyTo(xml);
@@ -79,7 +81,6 @@ HRESULT ToastNotification::Show(_In_ ToastEventHandler* handler) notification->add_Activated(eventHandler.Get(), &activatedToken);
notification->add_Dismissed(eventHandler.Get(), &dismissedToken);
notification->add_Failed(eventHandler.Get(), &failedToken);
-
return notifier->Show(notification.Get());
}
|