summaryrefslogtreecommitdiff
path: root/src/modules/utils
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-21 21:30:00 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-21 21:30:00 +0000
commitc5427646b03c73c179a31505671a9ad785709eb3 (patch)
tree7ee41e1c0f8371ae16ad28ae72cbadb0985da342 /src/modules/utils
parentb13718369be20aed4c522db164078bebc34e6744 (diff)
fix for crash in StdMsg dynamic unload
git-svn-id: http://svn.miranda-ng.org/main/trunk@7822 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/utils')
-rw-r--r--src/modules/utils/windowlist.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp
index dfea007733..04f5963ca9 100644
--- a/src/modules/utils/windowlist.cpp
+++ b/src/modules/utils/windowlist.cpp
@@ -35,17 +35,16 @@ static INT_PTR AllocWindowList(WPARAM, LPARAM)
static INT_PTR AddToWindowList(WPARAM, LPARAM lParam)
{
- windowList = (WINDOWLISTENTRY*)mir_realloc(windowList, sizeof(WINDOWLISTENTRY)*(windowListCount+1));
+ windowList = (WINDOWLISTENTRY*)mir_realloc(windowList, sizeof(WINDOWLISTENTRY)*(windowListCount + 1));
windowList[windowListCount++] = *(WINDOWLISTENTRY*)lParam;
return 0;
}
static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam)
{
- int i;
- for (i=0;i<windowListCount;i++)
+ for (int i = 0; i < windowListCount; i++)
if (windowList[i].hwnd == (HWND)lParam && windowList[i].hList == (HANDLE)wParam) {
- MoveMemory(&windowList[i], &windowList[i+1], sizeof(WINDOWLISTENTRY)*(windowListCount-i-1));
+ MoveMemory(&windowList[i], &windowList[i + 1], sizeof(WINDOWLISTENTRY)*(windowListCount - i - 1));
windowListCount--;
return 0;
}
@@ -54,18 +53,16 @@ static INT_PTR RemoveFromWindowList(WPARAM wParam, LPARAM lParam)
static INT_PTR FindInWindowList(WPARAM wParam, LPARAM lParam)
{
- int i;
- for (i=0;i<windowListCount;i++)
+ for (int i = 0; i < windowListCount; i++)
if (windowList[i].hContact == (HANDLE)lParam && windowList[i].hList == (HANDLE)wParam)
return (INT_PTR)windowList[i].hwnd;
- return (INT_PTR)(HWND)NULL;
+ return 0;
}
static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam)
{
- int i;
MSG *msg = (MSG*)lParam;
- for (i=0;i<windowListCount;i++)
+ for (int i = windowListCount-1; i >= 0; i--)
if (windowList[i].hList == (HANDLE)wParam)
SendMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam);
return 0;
@@ -73,9 +70,8 @@ static INT_PTR BroadcastToWindowList(WPARAM wParam, LPARAM lParam)
static INT_PTR BroadcastToWindowListAsync(WPARAM wParam, LPARAM lParam)
{
- int i;
MSG *msg = (MSG*)lParam;
- for (i=0;i<windowListCount;i++)
+ for (int i = windowListCount - 1; i >= 0; i--)
if (windowList[i].hList == (HANDLE)wParam)
PostMessage(windowList[i].hwnd, msg->message, msg->wParam, msg->lParam);
return 0;