From ef0abe4f9f67eeff4007f4839ba08a503472c74c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Jan 2014 23:24:02 +0000 Subject: - new typed helper, WindowList_Create, to create a window list - new service, WindowList_Destroy, to destroy a window list - internal windowlist.cpp implementation rewritten to LIST<> git-svn-id: http://svn.miranda-ng.org/main/trunk@7823 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdaway/awaymsg.cpp | 7 +++++-- src/core/stdmsg/src/globals.cpp | 4 ++-- src/core/stdmsg/src/msgs.cpp | 1 + src/core/stduihist/history.cpp | 8 +++++--- src/core/stdurl/url.cpp | 9 +++++---- src/core/stduserinfo/userinfo.cpp | 3 ++- 6 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/stdaway/awaymsg.cpp b/src/core/stdaway/awaymsg.cpp index 08d841275c..119fe411b4 100644 --- a/src/core/stdaway/awaymsg.cpp +++ b/src/core/stdaway/awaymsg.cpp @@ -158,13 +158,16 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) static int AwayMsgPreShutdown(WPARAM, LPARAM) { - if (hWindowList) WindowList_BroadcastAsync(hWindowList, WM_CLOSE, 0, 0); + if (hWindowList) { + WindowList_BroadcastAsync(hWindowList, WM_CLOSE, 0, 0); + WindowList_Destroy(hWindowList); + } return 0; } int LoadAwayMsgModule(void) { - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + hWindowList = WindowList_Create(); CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetMessageCommand); CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 2260f2d0db..466001fb5d 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -48,13 +48,13 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) static int OnShutdown(WPARAM, LPARAM) { - WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0); + WindowList_Destroy(g_dat.hMessageWindowList); return 0; } void InitGlobals() { - g_dat.hMessageWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + g_dat.hMessageWindowList = WindowList_Create(); HookEvent(ME_DB_EVENT_ADDED, dbaddedevent); HookEvent(ME_PROTO_ACK, ackevent); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index fa04cab531..53a2314fa8 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -298,6 +298,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) int PreshutdownSendRecv(WPARAM, LPARAM) { WindowList_Broadcast(g_dat.hMessageWindowList, WM_CLOSE, 0, 0); + DeinitStatusIcons(); return 0; } diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index 0152d177bf..55795e62bc 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -398,8 +398,10 @@ static int HistoryContactDelete(WPARAM wParam, LPARAM) int PreShutdownHistoryModule(WPARAM, LPARAM) { - if (hWindowList) - WindowList_BroadcastAsync(hWindowList, WM_DESTROY, 0, 0); + if (hWindowList) { + WindowList_Broadcast(hWindowList, WM_DESTROY, 0, 0); + WindowList_Destroy(hWindowList); + } return 0; } @@ -413,7 +415,7 @@ int LoadHistoryModule(void) Menu_AddContactMenuItem(&mi); CreateServiceFunction(MS_HISTORY_SHOWCONTACTHISTORY, UserHistoryCommand); - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + hWindowList = WindowList_Create(); HookEvent(ME_DB_CONTACT_DELETED, HistoryContactDelete); HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdownHistoryModule); return 0; diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index eae566e402..ee096ac8df 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -138,9 +138,10 @@ static int SRUrlShutdown(WPARAM, LPARAM) if (hContactDeleted) UnhookEvent(hContactDeleted); - if (hUrlWindowList) - WindowList_BroadcastAsync(hUrlWindowList, WM_CLOSE, 0, 0); - + if (hUrlWindowList) { + WindowList_Broadcast(hUrlWindowList, WM_CLOSE, 0, 0); + WindowList_Destroy(hUrlWindowList); + } return 0; } @@ -155,7 +156,7 @@ int UrlContactDeleted(WPARAM wParam, LPARAM) int LoadSendRecvUrlModule(void) { - hUrlWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + hUrlWindowList = WindowList_Create(); HookEvent(ME_SYSTEM_MODULESLOADED, SRUrlModulesLoaded); HookEvent(ME_DB_EVENT_ADDED, UrlEventAdded); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, SRUrlPreBuildMenu); diff --git a/src/core/stduserinfo/userinfo.cpp b/src/core/stduserinfo/userinfo.cpp index bd958a9202..adb844c56e 100644 --- a/src/core/stduserinfo/userinfo.cpp +++ b/src/core/stduserinfo/userinfo.cpp @@ -621,6 +621,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP static int ShutdownUserInfo(WPARAM, LPARAM) { WindowList_BroadcastAsync(hWindowList, WM_DESTROY, 0, 0); + WindowList_Destroy(hWindowList); return 0; } @@ -646,6 +647,6 @@ int LoadUserInfoModule(void) mi.pszName = LPGEN("View/change my &details..."); Menu_AddMainMenuItem(&mi); - hWindowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); + hWindowList = WindowList_Create(); return 0; } -- cgit v1.2.3