summaryrefslogtreecommitdiff
path: root/plugins/YAPP/message_pump.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/message_pump.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/message_pump.cpp')
-rw-r--r--plugins/YAPP/message_pump.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/plugins/YAPP/message_pump.cpp b/plugins/YAPP/message_pump.cpp
index 4a2b05b081..7e2cea5f0c 100644
--- a/plugins/YAPP/message_pump.cpp
+++ b/plugins/YAPP/message_pump.cpp
@@ -72,7 +72,8 @@ bool is_workstation_locked()
}
-unsigned __stdcall MessagePumpThread(void* param) {
+unsigned __stdcall MessagePumpThread(void* param)
+{
InitWindowStack();
if(param) SetEvent((HANDLE)param);
@@ -81,65 +82,64 @@ unsigned __stdcall MessagePumpThread(void* param) {
while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) {
switch(hwndMsg.message) {
- case MUM_CREATEPOPUP:
- {
- bool enabled = true;
- int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
- if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
- enabled = false;
- if ((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
- enabled = false;
-
- PopupData *pd = (PopupData *)hwndMsg.lParam;
- if(enabled && num_popups < MAX_POPUPS) {
- //HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
- HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
- num_popups++;
- if(hwndMsg.wParam) // set notifyer handle
- SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
- } else {
- if (pd) {
- mir_free(pd->pwzTitle);
- mir_free(pd->pwzText);
- mir_free(pd);
- }
- }
- }
- break;
-
- case MUM_DELETEPOPUP:
- {
- HWND hwnd = (HWND)hwndMsg.lParam;
- if(IsWindow(hwnd)) {
- DestroyWindow(hwnd);
- num_popups--;
+ case MUM_CREATEPOPUP:
+ {
+ bool enabled = true;
+ int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
+ if(status >= ID_STATUS_OFFLINE && status <= ID_STATUS_OUTTOLUNCH && options.disable_status[status - ID_STATUS_OFFLINE])
+ enabled = false;
+ if ((options.disable_full_screen && is_full_screen()) || is_workstation_locked())
+ enabled = false;
+
+ PopupData *pd = (PopupData *)hwndMsg.lParam;
+ if(enabled && num_popups < MAX_POPUPS) {
+ //HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, GetDesktopWindow(), 0, hInst, (LPVOID)hwndMsg.lParam);
+ HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("Popup"), WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam);
+ num_popups++;
+ if(hwndMsg.wParam) // set notifyer handle
+ SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0);
+ } else {
+ if (pd) {
+ mir_free(pd->pwzTitle);
+ mir_free(pd->pwzText);
+ mir_free(pd);
}
}
- break;
- case MUM_NMUPDATE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_UPDATENOTIFY, (WPARAM)hNotify, 0);
- }
- break;
- case MUM_NMREMOVE:
- {
- HANDLE hNotify = (HANDLE)hwndMsg.wParam;
- BroadcastMessage(PUM_KILLNOTIFY, (WPARAM)hNotify, 0);
- }
- break;
- case MUM_NMAVATAR:
- RepositionWindows();
- break;
- default:
- {
- TranslateMessage(&hwndMsg);
- DispatchMessage(&hwndMsg);
- // do this here in case the window has gone
- if(hwndMsg.message == PUM_CHANGE || hwndMsg.message == PUM_SETTEXT)
- mir_free((void *)hwndMsg.lParam);
+ }
+ break;
+
+ case MUM_DELETEPOPUP:
+ {
+ HWND hwnd = (HWND)hwndMsg.lParam;
+ if(IsWindow(hwnd)) {
+ DestroyWindow(hwnd);
+ num_popups--;
}
- break;
+ }
+ break;
+
+ case MUM_NMUPDATE:
+ {
+ HANDLE hNotify = (HANDLE)hwndMsg.wParam;
+ BroadcastMessage(PUM_UPDATENOTIFY, (WPARAM)hNotify, 0);
+ }
+ break;
+
+ case MUM_NMREMOVE:
+ {
+ HANDLE hNotify = (HANDLE)hwndMsg.wParam;
+ BroadcastMessage(PUM_KILLNOTIFY, (WPARAM)hNotify, 0);
+ }
+ break;
+
+ case MUM_NMAVATAR:
+ RepositionWindows();
+ break;
+
+ default:
+ TranslateMessage(&hwndMsg);
+ DispatchMessage(&hwndMsg);
+ break;
}
}
}
@@ -149,7 +149,7 @@ unsigned __stdcall MessagePumpThread(void* param) {
//if(param) SetEvent((HANDLE)param);
- DeinitOptions();
+ DeinitOptions();
DeinitServices();
return 0;