From fe4e211fe45a0b04190d06dbf34fa13883df871a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 17 Mar 2013 12:04:21 +0000 Subject: more memory fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@4072 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_skinengine.cpp | 84 ++---- plugins/MenuItemEx/src/main.cpp | 9 +- plugins/MyDetails/src/data.cpp | 22 +- plugins/Popup/src/popup_thread.cpp | 361 +++++++++++-------------- 4 files changed, 200 insertions(+), 276 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index a3efe5439b..5c6e7df153 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -67,8 +67,6 @@ static SortedList * pEffectStack = NULL; static SKINOBJECTSLIST * pCurrentSkin = NULL; static char ** pszSettingName = NULL; static int nArrayLen = 0; -static char * iniCurrentSection = NULL; -static char * szFileName = NULL; static BYTE pbGammaWeight[256] = {0}; static BYTE pbGammaWeightAdv[256] = {0}; @@ -194,48 +192,22 @@ HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, co // if ( strlen(szValue)>0 && szValue[strlen(szValue)-1] == '\n' ) // szValue[strlen(szValue)-1] = '\0'; //kill linefeed at the end - switch(szValue[0]) - { + switch(szValue[0]) { case 'b': - { - BYTE P; - P = (BYTE)atoi(szValue+1); - db_set_b(NULL,szSection,szName,P); - } + db_set_b(NULL, szSection, szName, (BYTE)atoi(szValue+1)); break; + case 'w': - { - WORD P; - P = (WORD)atoi(szValue+1); - db_set_w(NULL,szSection,szName,P); - } + db_set_w(NULL, szSection, szName, (WORD)atoi(szValue+1)); break; + case 'd': - { - DWORD P; - P = (DWORD)atoi(szValue+1); - db_set_dw(NULL,szSection,szName,P); - } + db_set_dw(NULL, szSection, szName, (DWORD)atoi(szValue+1)); break; + case 's': db_set_s(NULL,szSection,szName,szValue+1); break; - case 'f': - if (szFileName) - { - char fn[MAX_PATH] = {0}; - char bb[MAX_PATH*2] = {0}; - int pp, i; - pp = -1; - PathToRelative(szFileName, fn); - { - for (i = strlen(fn); i >= 0; i--) if (fn[i] == '.') break; - if (i>0) fn[i] = '\0'; - } - _snprintf(bb,SIZEOF(bb),"%s\\%s",fn,szValue+1); - db_set_s(NULL,szSection,szName,bb); - } - break; } return S_OK; } @@ -1933,7 +1905,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename) //this function is required to load PNG to dib buffer myself -HBITMAP ske_LoadGlyphImage_Png2Dib(char * szFilename) +static HBITMAP ske_LoadGlyphImage_Png2Dib(const TCHAR *tszFilename) { HANDLE hFile, hMap = NULL; BYTE* ppMap = NULL; @@ -1946,12 +1918,12 @@ HBITMAP ske_LoadGlyphImage_Png2Dib(char * szFilename) return (HBITMAP)NULL; } - if (( hFile = CreateFileA( szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )) != INVALID_HANDLE_VALUE ) - if (( hMap = CreateFileMapping( hFile, NULL, PAGE_READONLY, 0, 0, NULL )) != NULL ) - if (( ppMap = ( BYTE* )MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL ) - cbFileSize = GetFileSize( hFile, NULL ); + if ((hFile = CreateFile(tszFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE) + if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL )) != NULL) + if ((ppMap = ( BYTE* )MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL) + cbFileSize = GetFileSize(hFile, NULL); - if ( cbFileSize != 0 ) { + if (cbFileSize != 0) { PNG2DIB param; param.pSource = ppMap; param.cbSourceSize = cbFileSize; @@ -2000,9 +1972,8 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) BITMAP bmpInfo; { - int l; - l = lstrlen(tszFileName); - memmove(ext,szFileName +(l-4),5); + int l = lstrlen(tszFileName); + lstrcpyn(ext, tszFileName+(l-4),5); } if ( !_tcschr(tszFileName,'%') && !PathFileExists(tszFileName)) return NULL; @@ -2012,33 +1983,27 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) f = 1; } else if ( ServiceExists("Image/Png2Dib") && mir_bool_tstrcmpi(ext, _T(".png"))) { - hBitmap = ske_LoadGlyphImage_Png2Dib(szFileName); + hBitmap = ske_LoadGlyphImage_Png2Dib(tszFileName); GetObject(hBitmap, sizeof(BITMAP), &bmpInfo); f = (bmpInfo.bmBits != NULL); - // hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFileName); - // f = 1; - } - else if (hImageDecoderModule == NULL || !mir_bool_tstrcmpi(ext, _T(".png"))) - hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)szFileName); - else - { + else if (hImageDecoderModule == NULL || !mir_bool_tstrcmpi(ext, _T(".png"))) { + hBitmap = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)tszFileName); + } + else { f = 1; ImgNewDecoder(&m_pImgDecoder); - if ( !ImgNewDIBFromFile(m_pImgDecoder, szFileName, &pImg)) - { + if ( !ImgNewDIBFromFile(m_pImgDecoder, _T2A(tszFileName), &pImg)) { ImgGetHandle(pImg, &hBitmap, (LPVOID *)&pBitmapBits); ImgDeleteDecoder(m_pImgDecoder); } } - if (hBitmap) - { - + + if (hBitmap) { GetObject(hBitmap, sizeof(BITMAP), &bmpInfo); if (bmpInfo.bmBitsPixel == 32) ske_PreMultiplyChanells(hBitmap,f); - else - { + else { HDC dc24,dc32; HBITMAP hBitmap32,obmp24,obmp32; dc32 = CreateCompatibleDC(NULL); @@ -2055,7 +2020,6 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) hBitmap = hBitmap32; ske_PreMultiplyChanells(hBitmap,0); } - } return hBitmap; } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index e5dbad48c8..66579bdfb0 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -1279,7 +1279,6 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) return 0; } - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) { return &pluginInfoEx; @@ -1296,8 +1295,12 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { - DestroyIcon( hIcon[3] ); - DestroyIcon( hIcon[4] ); + for (int i=0; i < saveStatuses.getCount(); i++) + delete saveStatuses[i]; + saveStatuses.destroy(); + + DestroyIcon(hIcon[3]); + DestroyIcon(hIcon[4]); return 0; } diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index fa9ebf2ae9..e38c23ce7e 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -239,26 +239,14 @@ bool Protocol::CanSetStatusMsg(int aStatus) void Protocol::GetStatusMsg(int aStatus, TCHAR *msg, size_t msg_size) { if ( !CanGetStatusMsg()) - { lcopystr(msg, _T(""), msg_size); - return; - } - - if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG) ) - { - TCHAR *tmp = (TCHAR*) CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR); + else if (aStatus == status && ProtoServiceExists(name, PS_GETMYAWAYMSG)) { + mir_ptr tmp((TCHAR*)CallProtoService(name, PS_GETMYAWAYMSG, 0, SGMA_TCHAR)); lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size); } - - else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) - { - TCHAR *tmp = (TCHAR*) CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0); - if (tmp != NULL) - { - lcopystr(msg, tmp, msg_size); - mir_free(tmp); - } - else lcopystr(msg, _T(""), msg_size); + else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) { + mir_ptr tmp((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)aStatus, 0)); + lcopystr(msg, tmp == NULL ? _T("") : tmp, msg_size); } } diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index cbba209c62..711a65ab95 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -26,21 +26,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //#include // globals -//static unsigned idPopupThread = 0; -static int gIdleRequests = 0; -static bool gTerminating = false; +static int gIdleRequests = 0; +static bool gTerminating = false; static HANDLE hThreadMutex = NULL; -static HWND gHwndManager = 0; -static int gLockCount = 0; +static HWND gHwndManager = 0; +static int gLockCount = 0; static volatile int nPopups = 0; -//typedef std::list PopupList; typedef LIST PopupList; -static PopupList popupList(3); +static PopupList popupList(3, PopupList::FTSortFunc(PtrKeySortT)); // forwards enum -{ // message id's +{ + // message id's UTM_PT_FIRST = WM_USER+1607, UTM_STOP_THREAD, UTM_ADD_WINDOW, @@ -51,68 +50,6 @@ enum UTM_UNLOCK_QUEUE, UTM_REQUEST_REMOVE }; -static void __cdecl PopupThread(void *arg); - -// interface -void LoadPopupThread() -{ - hThreadMutex = CreateMutex(NULL, FALSE, NULL); - mir_forkthread(PopupThread, NULL); -} - -void StopPopupThread() -{ - PostMessage(gHwndManager, UTM_STOP_THREAD, 0, 0); -} - -void UnloadPopupThread() -{ -// We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us. - WaitForSingleObject(hThreadMutex, INFINITE); - CloseHandle(hThreadMutex); -} - -void PopupThreadLock() -{ - PostMessage(gHwndManager, UTM_LOCK_QUEUE, 0, 0); -} - -void PopupThreadUnlock() -{ - PostMessage(gHwndManager, UTM_UNLOCK_QUEUE, 0, 0); -} - -bool PopupThreadIsFull() -{ -// char buf[128]; -// wsprintf(buf, "%d, %d", nPopups, PopUpOptions.MaxPopups); -// MessageBoxA(NULL, buf, "Popup Plus", MB_OK); - return nPopups >= PopUpOptions.MaxPopups; -} - -bool PopupThreadAddWindow(PopupWnd2 *wnd) -{ - PostMessage(gHwndManager, UTM_ADD_WINDOW, 0, (LPARAM)wnd); - return true; -} - -bool PopupThreadRemoveWindow(PopupWnd2 *wnd) -{ - PostMessage(gHwndManager, UTM_REMOVE_WINDOW, 0, (LPARAM)wnd); - return true; -} - -bool PopupThreadUpdateWindow(PopupWnd2 *wnd) -{ - PostMessage(gHwndManager, UTM_UPDATE_WINDOW, 0, (LPARAM)wnd); - return true; -} - -bool PopupThreadRequestRemoveWindow(PopupWnd2 *wnd) -{ - PostMessage(gHwndManager, UTM_REQUEST_REMOVE, 0, (LPARAM)wnd); - return true; -} bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) { @@ -123,31 +60,25 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) POINT pos; SIZE prevSize = {0}, curSize = wnd->getSize(); - if (prev) prevSize = prev->getSize(); + if (prev) + prevSize = prev->getSize(); + //we have only one monitor (cant check it together with 1.if) RECT rc; -// SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); - - - if (GetSystemMetrics(SM_CMONITORS)==1) { //we have only one monitor (cant check it together with 1.if) - SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); - } + if ( GetSystemMetrics(SM_CMONITORS) == 1) + SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, 0); else { //Multimonitor stuff (we have more then 1) - HMONITOR hMonitor = NULL; - HWND hWnd = NULL; - MONITORINFOEX mnti; // = { 0 }; - + HWND hWnd; if (PopUpOptions.Monitor == MN_MIRANDA) hWnd = (HWND)CallService(MS_CLUI_GETHWND,0,0); else // PopUpOptions.Monitor == MN_ACTIVE hWnd = GetForegroundWindow(); - mnti.cbSize = sizeof(MONITORINFOEX); - - - hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); - if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&mnti) == TRUE) //It worked + HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY); + MONITORINFOEX mnti; + mnti.cbSize = sizeof(MONITORINFOEX); + if ( GetMonitorInfo(hMonitor, &mnti) == TRUE) CopyMemory(&rc, &(mnti.rcWork), sizeof(RECT)); else SystemParametersInfo(SPI_GETWORKAREA,0,&rc,0); @@ -157,48 +88,44 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) rc.right -= PopUpOptions.gapRight - POPUP_SPACING; rc.top += PopUpOptions.gapTop - POPUP_SPACING; rc.bottom -= PopUpOptions.gapBottom - POPUP_SPACING; - if (PopUpOptions.Spreading == SPREADING_VERTICAL) - { - switch (PopUpOptions.Position) - { - case POS_UPPERLEFT: - pos.x = rc.left + POPUP_SPACING; - pos.y = (prev ? (prev->getPosition().y + prev->getSize().cy) : rc.top) + POPUP_SPACING; - break; - case POS_LOWERLEFT: - pos.x = rc.left + POPUP_SPACING; - pos.y = (prev ? prev->getPosition().y : rc.bottom) - wnd->getSize().cy - POPUP_SPACING; - break; - case POS_LOWERRIGHT: - pos.x = rc.right - wnd->getSize().cx - POPUP_SPACING; - pos.y = (prev ? prev->getPosition().y : rc.bottom) - wnd->getSize().cy - POPUP_SPACING; - break; - case POS_UPPERRIGHT: - pos.x = rc.right - wnd->getSize().cx - POPUP_SPACING; - pos.y = (prev ? (prev->getPosition().y + prev->getSize().cy) : rc.top) + POPUP_SPACING; - break; + if (PopUpOptions.Spreading == SPREADING_VERTICAL) { + switch (PopUpOptions.Position) { + case POS_UPPERLEFT: + pos.x = rc.left + POPUP_SPACING; + pos.y = (prev ? (prev->getPosition().y + prev->getSize().cy) : rc.top) + POPUP_SPACING; + break; + case POS_LOWERLEFT: + pos.x = rc.left + POPUP_SPACING; + pos.y = (prev ? prev->getPosition().y : rc.bottom) - wnd->getSize().cy - POPUP_SPACING; + break; + case POS_LOWERRIGHT: + pos.x = rc.right - wnd->getSize().cx - POPUP_SPACING; + pos.y = (prev ? prev->getPosition().y : rc.bottom) - wnd->getSize().cy - POPUP_SPACING; + break; + case POS_UPPERRIGHT: + pos.x = rc.right - wnd->getSize().cx - POPUP_SPACING; + pos.y = (prev ? (prev->getPosition().y + prev->getSize().cy) : rc.top) + POPUP_SPACING; + break; } - } else - // if (PopUpOptions.Spreading == SPREADING_HORIZONTAL) - { - switch (PopUpOptions.Position) - { - case POS_UPPERLEFT: - pos.x = (prev ? (prev->getPosition().x + prev->getSize().cx) : rc.left) + POPUP_SPACING; - pos.y = rc.top + POPUP_SPACING; - break; - case POS_LOWERLEFT: - pos.x = (prev ? (prev->getPosition().x + prev->getSize().cx) : rc.left) + POPUP_SPACING; - pos.y = rc.bottom - wnd->getSize().cy - POPUP_SPACING; - break; - case POS_LOWERRIGHT: - pos.x = (prev ? prev->getPosition().x : rc.right) - wnd->getSize().cx - POPUP_SPACING; - pos.y = rc.bottom - wnd->getSize().cy - POPUP_SPACING; - break; - case POS_UPPERRIGHT: - pos.x = (prev ? prev->getPosition().x : rc.right) - wnd->getSize().cx - POPUP_SPACING; - pos.y = rc.top + POPUP_SPACING; - break; + } + else { + switch (PopUpOptions.Position) { + case POS_UPPERLEFT: + pos.x = (prev ? (prev->getPosition().x + prev->getSize().cx) : rc.left) + POPUP_SPACING; + pos.y = rc.top + POPUP_SPACING; + break; + case POS_LOWERLEFT: + pos.x = (prev ? (prev->getPosition().x + prev->getSize().cx) : rc.left) + POPUP_SPACING; + pos.y = rc.bottom - wnd->getSize().cy - POPUP_SPACING; + break; + case POS_LOWERRIGHT: + pos.x = (prev ? prev->getPosition().x : rc.right) - wnd->getSize().cx - POPUP_SPACING; + pos.y = rc.bottom - wnd->getSize().cy - POPUP_SPACING; + break; + case POS_UPPERRIGHT: + pos.x = (prev ? prev->getPosition().x : rc.right) - wnd->getSize().cx - POPUP_SPACING; + pos.y = rc.top + POPUP_SPACING; + break; } } wnd->setPosition(pos); @@ -208,10 +135,8 @@ bool UpdatePopupPosition(PopupWnd2 *prev, PopupWnd2 *wnd) void RepositionPopups() { PopupWnd2 *prev = 0; - if (PopUpOptions.ReorderPopUps) - { - for (int i=0; i < popupList.getCount(); ++i) - { + if (PopUpOptions.ReorderPopUps) { + for (int i=0; i < popupList.getCount(); ++i) { UpdatePopupPosition(prev, popupList[i]); prev = popupList[i]; } @@ -221,75 +146,55 @@ void RepositionPopups() static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PopupWnd2 *wnd = NULL; - if (message == UTM_ADD_WINDOW || - message == UTM_UPDATE_WINDOW || - message == UTM_REMOVE_WINDOW || - message == UTM_REQUEST_REMOVE) - { + if (message == UTM_ADD_WINDOW || message == UTM_UPDATE_WINDOW || message == UTM_REMOVE_WINDOW || message == UTM_REQUEST_REMOVE) if (!(wnd = (PopupWnd2 *)lParam)) return 0; - } - switch (message) - { - case UTM_STOP_THREAD: - { - gTerminating = true; - if (DBGetContactSettingByte(NULL, MODULNAME, "FastExit", 0)) - for (int i=0; i < popupList.getCount(); ++i) - PUDeletePopUp(popupList[i]->getHwnd()); - PostQuitMessage(0); - break; - } - case UTM_ADD_WINDOW: - { - if (gTerminating) break; - UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount()-1] : 0, wnd); - popupList.insert(wnd); - ++nPopups; - wnd->callMethodAsync(&PopupWnd2::m_show, 0); - break; - } - case UTM_UPDATE_WINDOW: - { - RepositionPopups(); - break; - } - case UTM_REQUEST_REMOVE: - { - if ((PopUpOptions.LeaveHovered && gLockCount) || (wnd && wnd->isLocked())) - { - wnd->updateTimer(); - } else - { - PostMessage(wnd->getHwnd(), WM_CLOSE, 0, 0); - } - break; - } - case UTM_REMOVE_WINDOW: - { - // popupList.remove(ptr) would be nicer, but it requires sortFunc :( + + switch (message) { + case UTM_STOP_THREAD: + gTerminating = true; + if (DBGetContactSettingByte(NULL, MODULNAME, "FastExit", 0)) for (int i=0; i < popupList.getCount(); ++i) - if (popupList[i] == wnd) - { - popupList.remove(i); - RepositionPopups(); - --nPopups; - delete wnd; - break; - } - break; - } - case UTM_LOCK_QUEUE: - { - ++gLockCount; - break; - } - case UTM_UNLOCK_QUEUE: - { - if (--gLockCount < 0) - gLockCount = 0; + PUDeletePopUp(popupList[i]->getHwnd()); + PostQuitMessage(0); + break; + + case UTM_ADD_WINDOW: + if (gTerminating) break; - } + UpdatePopupPosition(popupList.getCount() ? popupList[popupList.getCount()-1] : 0, wnd); + popupList.insert(wnd); + ++nPopups; + wnd->callMethodAsync(&PopupWnd2::m_show, 0); + break; + + case UTM_UPDATE_WINDOW: + RepositionPopups(); + break; + + case UTM_REQUEST_REMOVE: + if ((PopUpOptions.LeaveHovered && gLockCount) || (wnd && wnd->isLocked())) + wnd->updateTimer(); + else + PostMessage(wnd->getHwnd(), WM_CLOSE, 0, 0); + break; + + case UTM_REMOVE_WINDOW: + popupList.remove(wnd); + RepositionPopups(); + --nPopups; + delete wnd; + break; + + case UTM_LOCK_QUEUE: + ++gLockCount; + break; + + case UTM_UNLOCK_QUEUE: + if (--gLockCount < 0) + gLockCount = 0; + break; + } return DefWindowProc(hwnd, message, wParam, lParam); } @@ -342,3 +247,67 @@ static void __cdecl PopupThread(void *arg) DestroyWindow(gHwndManager); gHwndManager = NULL; ReleaseMutex(hThreadMutex); hThreadMutex = NULL; } + +///////////////////////////////////////////////////////////////////////////////////////// +// interface + +void LoadPopupThread() +{ + hThreadMutex = CreateMutex(NULL, FALSE, NULL); + mir_forkthread(PopupThread, NULL); +} + +void StopPopupThread() +{ + PostMessage(gHwndManager, UTM_STOP_THREAD, 0, 0); +} + +void UnloadPopupThread() +{ + // We won't waint for thread to exit, Miranda's thread unsind mechanism will do that for us. + WaitForSingleObject(hThreadMutex, INFINITE); + CloseHandle(hThreadMutex); + + for (int i=0; i < popupList.getCount(); ++i) + delete popupList[i]; + popupList.destroy(); +} + +void PopupThreadLock() +{ + PostMessage(gHwndManager, UTM_LOCK_QUEUE, 0, 0); +} + +void PopupThreadUnlock() +{ + PostMessage(gHwndManager, UTM_UNLOCK_QUEUE, 0, 0); +} + +bool PopupThreadIsFull() +{ + return nPopups >= PopUpOptions.MaxPopups; +} + +bool PopupThreadAddWindow(PopupWnd2 *wnd) +{ + PostMessage(gHwndManager, UTM_ADD_WINDOW, 0, (LPARAM)wnd); + return true; +} + +bool PopupThreadRemoveWindow(PopupWnd2 *wnd) +{ + PostMessage(gHwndManager, UTM_REMOVE_WINDOW, 0, (LPARAM)wnd); + return true; +} + +bool PopupThreadUpdateWindow(PopupWnd2 *wnd) +{ + PostMessage(gHwndManager, UTM_UPDATE_WINDOW, 0, (LPARAM)wnd); + return true; +} + +bool PopupThreadRequestRemoveWindow(PopupWnd2 *wnd) +{ + PostMessage(gHwndManager, UTM_REQUEST_REMOVE, 0, (LPARAM)wnd); + return true; +} -- cgit v1.2.3