summaryrefslogtreecommitdiff
path: root/plugins/YAPP/services.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-17 08:35:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-17 08:35:51 +0000
commitee2e419778605a5445474a33a29f2cfbb7eed245 (patch)
tree404194e1d202f6433693f3833792e940c04e2d7e /plugins/YAPP/services.cpp
parent1ca120b165c2f2d9f521a04bfc31c7956d2ce422 (diff)
bunch of fixes for various memory-related problems
git-svn-id: http://svn.miranda-ng.org/main/trunk@1001 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP/services.cpp')
-rw-r--r--plugins/YAPP/services.cpp91
1 files changed, 46 insertions, 45 deletions
diff --git a/plugins/YAPP/services.cpp b/plugins/YAPP/services.cpp
index ea60b013b4..84e4330151 100644
--- a/plugins/YAPP/services.cpp
+++ b/plugins/YAPP/services.cpp
@@ -155,13 +155,14 @@ INT_PTR OldCreatePopupW(WPARAM wParam, LPARAM lParam) {
return 0;
}
-INT_PTR ChangeTextW(WPARAM wParam, LPARAM lParam) {
+INT_PTR ChangeTextW(WPARAM wParam, LPARAM lParam)
+{
HWND hwndPop = (HWND)wParam;
- wchar_t *newText = mir_wstrdup((wchar_t *)lParam);
+ wchar_t *newText = NEWWSTR_ALLOCA((wchar_t *)lParam);
StripBBCodesInPlace(newText);
if(IsWindow(hwndPop))
- PostMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)newText);
+ SendMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)newText);
else
mir_free(newText);
return 0;
@@ -174,9 +175,9 @@ INT_PTR ChangeTextA(WPARAM wParam, LPARAM lParam) {
StripBBCodesInPlace(buff);
if(IsWindow(hwndPop))
- PostMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)buff);
- else
- mir_free(buff);
+ SendMessage(hwndPop, PUM_SETTEXT, 0, (LPARAM)buff);
+
+ mir_free(buff);
return 0;
}
@@ -286,32 +287,32 @@ INT_PTR PopupChangeA(WPARAM wParam, LPARAM lParam) {
POPUPDATAEX *pd_in = (POPUPDATAEX *)lParam;
if(IsWindow(hwndPop)) {
- PopupData *pd_out = (PopupData *)mir_alloc(sizeof(PopupData));
- pd_out->cbSize = sizeof(PopupData);
- pd_out->flags = PDF_UNICODE;
+ PopupData pd_out;
+ pd_out.cbSize = sizeof(PopupData);
+ pd_out.flags = PDF_UNICODE;
- pd_out->pwzTitle = mir_a2u(pd_in->lpzContactName);
- pd_out->pwzText = mir_a2u(pd_in->lpzText);
- StripBBCodesInPlace(pd_out->pwzTitle);
- StripBBCodesInPlace(pd_out->pwzText);
+ pd_out.pwzTitle = mir_a2u(pd_in->lpzContactName);
+ pd_out.pwzText = mir_a2u(pd_in->lpzText);
+ StripBBCodesInPlace(pd_out.pwzTitle);
+ StripBBCodesInPlace(pd_out.pwzText);
- pd_out->hContact = pd_in->lchContact;
- pd_out->hIcon = pd_in->lchIcon;
+ pd_out.hContact = pd_in->lchContact;
+ pd_out.hIcon = pd_in->lchIcon;
if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
- pd_out->colorBack = pd_out->colorText = 0;
+ pd_out.colorBack = pd_out.colorText = 0;
else {
- pd_out->colorBack = pd_in->colorBack & 0xFFFFFF;
- pd_out->colorText = pd_in->colorText & 0xFFFFFF;
+ pd_out.colorBack = pd_in->colorBack & 0xFFFFFF;
+ pd_out.colorText = pd_in->colorText & 0xFFFFFF;
}
- pd_out->colorBack = pd_in->colorBack;
- pd_out->colorText = pd_in->colorText;
- pd_out->windowProc = pd_in->PluginWindowProc;
- pd_out->opaque = pd_in->PluginData;
- pd_out->timeout = pd_in->iSeconds;
+ pd_out.colorBack = pd_in->colorBack;
+ pd_out.colorText = pd_in->colorText;
+ pd_out.windowProc = pd_in->PluginWindowProc;
+ pd_out.opaque = pd_in->PluginData;
+ pd_out.timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
-
- PostMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)pd_out);
+ lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0));
+
+ SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out);
}
return 0;
}
@@ -321,32 +322,32 @@ INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) {
POPUPDATAW *pd_in = (POPUPDATAW *)lParam;
if(IsWindow(hwndPop)) {
- PopupData *pd_out = (PopupData *)mir_alloc(sizeof(PopupData));
- pd_out->cbSize = sizeof(PopupData);
- pd_out->flags = PDF_UNICODE;
+ PopupData pd_out;
+ pd_out.cbSize = sizeof(PopupData);
+ pd_out.flags = PDF_UNICODE;
- pd_out->pwzTitle = mir_wstrdup(pd_in->lpwzContactName);
- pd_out->pwzText = mir_wstrdup(pd_in->lpwzText);
- StripBBCodesInPlace(pd_out->pwzTitle);
- StripBBCodesInPlace(pd_out->pwzText);
+ pd_out.pwzTitle = mir_wstrdup(pd_in->lpwzContactName);
+ pd_out.pwzText = mir_wstrdup(pd_in->lpwzText);
+ StripBBCodesInPlace(pd_out.pwzTitle);
+ StripBBCodesInPlace(pd_out.pwzText);
- pd_out->hContact = pd_in->lchContact;
- pd_out->hIcon = pd_in->lchIcon;
+ pd_out.hContact = pd_in->lchContact;
+ pd_out.hIcon = pd_in->lchIcon;
if(pd_in->colorBack == 0xffffffff) // that's the old #define for 'skinned bg'
- pd_out->colorBack = pd_out->colorText = 0;
+ pd_out.colorBack = pd_out.colorText = 0;
else {
- pd_out->colorBack = pd_in->colorBack & 0xFFFFFF;
- pd_out->colorText = pd_in->colorText & 0xFFFFFF;
+ pd_out.colorBack = pd_in->colorBack & 0xFFFFFF;
+ pd_out.colorText = pd_in->colorText & 0xFFFFFF;
}
- pd_out->colorBack = pd_in->colorBack;
- pd_out->colorText = pd_in->colorText;
- pd_out->windowProc = pd_in->PluginWindowProc;
- pd_out->opaque = pd_in->PluginData;
- pd_out->timeout = pd_in->iSeconds;
+ pd_out.colorBack = pd_in->colorBack;
+ pd_out.colorText = pd_in->colorText;
+ pd_out.windowProc = pd_in->PluginWindowProc;
+ pd_out.opaque = pd_in->PluginData;
+ pd_out.timeout = pd_in->iSeconds;
- lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
+ lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0));
- PostMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)pd_out);
+ SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out);
}
return 0;
}