summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-02 20:20:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-02 20:20:47 +0000
commit8712f0c3591941711f8407fc069a1fbd98efbd65 (patch)
treec75825bc3d05f543e622770c684e09113ddbeb79 /src
parentad5dee8e7d01ea0cd2b96a7f46e1f6fc9692825a (diff)
added destructor LIST::~LIST, that calls destroy() automatically.
thus manual call of destroy() might be removed from: - class destructors; - Unload() plugin's functions (for global data); - local (auto) variables in functions finalizations git-svn-id: http://svn.miranda-ng.org/main/trunk@7467 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/modules.cpp2
-rw-r--r--src/mir_core/langpack.cpp1
-rw-r--r--src/mir_core/miranda.cpp1
-rw-r--r--src/mir_core/miranda.h2
-rw-r--r--src/mir_core/modules.cpp4
-rw-r--r--src/mir_core/subclass.cpp5
-rw-r--r--src/modules/button/button.cpp11
-rw-r--r--src/modules/clist/clistmod.cpp1
-rw-r--r--src/modules/clist/genmenu.cpp2
-rw-r--r--src/modules/clist/movetogroup.cpp5
-rw-r--r--src/modules/crypt/encrypt.cpp1
-rw-r--r--src/modules/database/dbintf.cpp5
-rw-r--r--src/modules/database/dbutils.cpp3
-rw-r--r--src/modules/database/mdatabasecache.cpp3
-rw-r--r--src/modules/extraicons/ExtraIconGroup.cpp1
-rw-r--r--src/modules/extraicons/extraicons.cpp7
-rw-r--r--src/modules/extraicons/options_ei.cpp5
-rw-r--r--src/modules/icolib/skin2icons.cpp4
-rw-r--r--src/modules/netlib/netlib.cpp5
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp1
-rw-r--r--src/modules/options/filter.h6
-rw-r--r--src/modules/plugins/newplugins.cpp4
-rw-r--r--src/modules/protocols/protoaccs.cpp6
-rw-r--r--src/modules/protocols/protocols.cpp4
-rw-r--r--src/modules/skin/hotkeys.cpp1
-rw-r--r--src/modules/skin/sounds.cpp2
-rw-r--r--src/modules/srmm/statusicon.cpp1
-rw-r--r--src/modules/utils/timezones.cpp6
-rw-r--r--src/modules/utils/utils.cpp2
29 files changed, 9 insertions, 92 deletions
diff --git a/src/core/modules.cpp b/src/core/modules.cpp
index e90d18941d..b1d7cbafcb 100644
--- a/src/core/modules.cpp
+++ b/src/core/modules.cpp
@@ -68,7 +68,6 @@ void UnloadButtonModule(void);
void UnloadClcModule(void);
void UnloadContactListModule(void);
void UnloadDatabase(void);
-void UnloadDbintfModule(void);
void UnloadErrorsModule(void);
void UnloadEventsModule(void);
void UnloadExtraIconsModule(void);
@@ -179,6 +178,5 @@ void UnloadDefaultModules(void)
UnloadContactListModule();
UnloadEventsModule();
UnloadNetlibModule();
- UnloadDbintfModule();
UnloadSslModule();
}
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp
index a23e6311a6..885b6c7f9e 100644
--- a/src/mir_core/langpack.cpp
+++ b/src/mir_core/langpack.cpp
@@ -597,7 +597,6 @@ void UnloadLangPackModule()
int i;
for (i=0; i < lMuuids.getCount(); i++)
mir_free(lMuuids[i]);
- lMuuids.destroy();
LangPackEntry *p = langPack.entry;
for (i=0; i < langPack.entryCount; i++, p++) {
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp
index 4804665e45..639de6b0c1 100644
--- a/src/mir_core/miranda.cpp
+++ b/src/mir_core/miranda.cpp
@@ -102,7 +102,6 @@ MIR_CORE_DLL(void) UnloadCoreModule(void)
CloseHandle(hThreadQueueEmpty);
TlsFree(mir_tls);
- UninitSubclassing();
UninitProtocols();
DestroyModularEngine();
UninitLogs();
diff --git a/src/mir_core/miranda.h b/src/mir_core/miranda.h
index cc4be6ecae..122d9fe21d 100644
--- a/src/mir_core/miranda.h
+++ b/src/mir_core/miranda.h
@@ -93,8 +93,6 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR *name);
/**** subclass.cpp *********************************************************************/
-void UninitSubclassing();
-
/**** threads.cpp **********************************************************************/
extern DWORD mir_tls;
diff --git a/src/mir_core/modules.cpp b/src/mir_core/modules.cpp
index 0352802dfe..6899a2dbf3 100644
--- a/src/mir_core/modules.cpp
+++ b/src/mir_core/modules.cpp
@@ -652,12 +652,8 @@ int InitialiseModularEngine(void)
void DestroyModularEngine(void)
{
DestroyHooks();
- hooks.destroy();
DeleteCriticalSection(&csHooks);
DestroyServices();
- services.destroy();
DeleteCriticalSection(&csServices);
-
- pluginListAddr.destroy();
}
diff --git a/src/mir_core/subclass.cpp b/src/mir_core/subclass.cpp
index 74d500aee2..ca5dc88d2b 100644
--- a/src/mir_core/subclass.cpp
+++ b/src/mir_core/subclass.cpp
@@ -33,11 +33,6 @@ struct MSubclassData
static LIST<MSubclassData> arSubclass(10, LIST<MSubclassData>::FTSortFunc(HandleKeySortT));
-void UninitSubclassing()
-{
- arSubclass.destroy();
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp
index 62b5c131cc..437f24f925 100644
--- a/src/modules/button/button.cpp
+++ b/src/modules/button/button.cpp
@@ -613,9 +613,10 @@ int LoadButtonModule(void)
{
if (bModuleInitialized)
return 0;
- bModuleInitialized = TRUE;
- WNDCLASSEX wc = {0};
+ bModuleInitialized = true;
+
+ WNDCLASSEX wc = { 0 };
wc.cbSize = sizeof(wc);
wc.lpszClassName = MIRANDABUTTONCLASS;
wc.lpfnWndProc = MButtonWndProc;
@@ -635,12 +636,8 @@ int LoadButtonModule(void)
void UnloadButtonModule()
{
- if ( !bModuleInitialized)
+ if (!bModuleInitialized)
return;
- {
- mir_cslock lck(csTips);
- lToolTips.destroy();
- }
DeleteCriticalSection(&csTips);
}
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index a20ee87a0a..547fcc326d 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -541,6 +541,5 @@ void UnloadContactListModule()
}
ImageList_Destroy(hCListImages);
UninitCListEvents();
- protoIconIndex.destroy();
DestroyHookableEvent(hContactDoubleClicked);
}
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index aa9430712c..07c40e5990 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -186,7 +186,6 @@ int MO_RemoveAllObjects()
{
for (int i=0; i < g_menus.getCount(); i++)
delete g_menus[i];
-
g_menus.destroy();
return 0;
}
@@ -590,7 +589,6 @@ void KillModuleMenus(int hLangpack)
for (int k=0; k < param.arItems.getCount(); k++)
MO_RemoveMenuItem((WPARAM)param.arItems[k], 0);
- param.arItems.destroy();
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp
index b858013c78..b296a1c3a3 100644
--- a/src/modules/clist/movetogroup.cpp
+++ b/src/modules/clist/movetogroup.cpp
@@ -109,8 +109,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
pos += 100000; // Separator
- for (i=0; ; i++)
- {
+ for (i=0; ; i++) {
char intname[20];
_itoa(i, intname, 10);
@@ -129,7 +128,6 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
AddGroupItem(hMoveToGroupItem, groups[i].name, ++pos, groups[i].position, checked);
}
- groups.destroy();
return 0;
}
@@ -147,6 +145,5 @@ void MTG_OnmodulesLoad()
int UnloadMoveToGroup(void)
{
- lphGroupsItems.destroy();
return 0;
}
diff --git a/src/modules/crypt/encrypt.cpp b/src/modules/crypt/encrypt.cpp
index ddea529674..d464a3e899 100644
--- a/src/modules/crypt/encrypt.cpp
+++ b/src/modules/crypt/encrypt.cpp
@@ -85,5 +85,4 @@ void UninitCrypt(void)
mir_free(p->pszDescr);
delete p;
}
- arDbPlugins.destroy();
}
diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp
index 72afdb4866..35a0557362 100644
--- a/src/modules/database/dbintf.cpp
+++ b/src/modules/database/dbintf.cpp
@@ -166,8 +166,3 @@ int LoadDbintfModule()
CreateServiceFunction(MS_DB_DESTROY_INSTANCE, srvDestroyInstance);
return 0;
}
-
-void UnloadDbintfModule()
-{
- arDbPlugins.destroy();
-}
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp
index 302d7fdd65..f57ce37446 100644
--- a/src/modules/database/dbutils.cpp
+++ b/src/modules/database/dbutils.cpp
@@ -274,7 +274,6 @@ static INT_PTR DbDeleteModule(WPARAM, LPARAM lParam)
db_unset(NULL, (char*)lParam, vars[i]);
mir_free(vars[i]);
}
- vars.destroy();
return 0;
}
@@ -366,6 +365,4 @@ void UnloadEventsModule()
mir_free(p->iconService);
mir_free(p);
}
-
- eventTypes.destroy();
}
diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp
index 6a8a58c1f4..f6c13e0cda 100644
--- a/src/modules/database/mdatabasecache.cpp
+++ b/src/modules/database/mdatabasecache.cpp
@@ -45,9 +45,6 @@ MDatabaseCache::MDatabaseCache() :
MDatabaseCache::~MDatabaseCache()
{
- m_lContacts.destroy();
- m_lSettings.destroy();
- m_lGlobalSettings.destroy();
HeapDestroy(m_hCacheHeap);
DeleteCriticalSection(&m_cs);
}
diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp
index e2127ebb87..5ec33e2b2c 100644
--- a/src/modules/extraicons/ExtraIconGroup.cpp
+++ b/src/modules/extraicons/ExtraIconGroup.cpp
@@ -32,7 +32,6 @@ ExtraIconGroup::ExtraIconGroup(const char *_name) :
ExtraIconGroup::~ExtraIconGroup()
{
- items.destroy();
}
void ExtraIconGroup::addExtraIcon(BaseExtraIcon *extra)
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp
index c96dd3629f..99abd93ed0 100644
--- a/src/modules/extraicons/extraicons.cpp
+++ b/src/modules/extraicons/extraicons.cpp
@@ -227,11 +227,9 @@ void KillModuleExtraIcons(int hLangpack)
LIST<ExtraIconGroup> groups(1);
LoadGroups(groups);
RebuildListsBasedOnGroups(groups);
- groups.destroy();
for (int k=0; k < arDeleted.getCount(); k++)
delete arDeleted[k];
- arDeleted.destroy();
}
///////////////////////////////////////////////////////////////////////////////
@@ -457,7 +455,6 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
}
}
- groups.destroy();
return id;
}
@@ -541,8 +538,4 @@ void UnloadExtraIconsModule(void)
{
for (int i=0; i < registeredExtraIcons.getCount(); i++)
delete registeredExtraIcons[i];
-
- registeredExtraIcons.destroy();
- extraIconsByHandle.destroy();
- extraIconsBySlot.destroy();
}
diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp
index 0edbec8050..8432b945a9 100644
--- a/src/modules/extraicons/options_ei.cpp
+++ b/src/modules/extraicons/options_ei.cpp
@@ -220,7 +220,6 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
TreeView_SelectItem(hwndDlg, hti.hItem);
Tree_Select(hwndDlg, selected);
- selected.destroy();
}
else if (wParam & MK_SHIFT) {
HTREEITEM hItem = TreeView_GetSelection(hwndDlg);
@@ -233,7 +232,6 @@ LRESULT CALLBACK TreeProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
TreeView_SelectItem(hwndDlg, hti.hItem);
Tree_Select(hwndDlg, selected);
Tree_SelectRange(hwndDlg, hItem, hti.hItem);
- selected.destroy();
}
return 0;
@@ -342,8 +340,6 @@ static void GroupSelectedItems(HWND tree)
UnselectAll(tree);
TreeView_SelectItem(tree, hNew);
}
-
- toRemove.destroy();
}
static void UngroupSelectedItems(HWND tree)
@@ -587,7 +583,6 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
delete[] oldSlots;
- groups.destroy();
return TRUE;
}
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp
index 585e26ab60..e5a21e7a56 100644
--- a/src/modules/icolib/skin2icons.cpp
+++ b/src/modules/icolib/skin2icons.cpp
@@ -881,7 +881,6 @@ void UnloadIcoLibModule(void)
IcoLib_FreeIcon(p);
mir_free(p);
}
- iconList.destroy();
for (i = iconSourceList.getCount()-1; i >= 0; i--) {
IconSourceItem* p = iconSourceList[i];
@@ -891,7 +890,6 @@ void UnloadIcoLibModule(void)
SAFE_FREE((void**)&p->icon_data);
SAFE_FREE((void**)&p);
}
- iconSourceList.destroy();
for (i = iconSourceFileList.getCount()-1; i >= 0; i--) {
IconSourceFile* p = iconSourceFileList[i];
@@ -899,13 +897,11 @@ void UnloadIcoLibModule(void)
SAFE_FREE((void**)&p->file);
SAFE_FREE((void**)&p);
}
- iconSourceFileList.destroy();
for (i = 0; i < sectionList.getCount(); i++) {
SAFE_FREE((void**)&sectionList[i]->name);
mir_free(sectionList[i]);
}
- sectionList.destroy();
SafeDestroyIcon(&hIconBlank);
bModuleInitialized = false;
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index c42b43a89f..dff3084348 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -423,10 +423,9 @@ void UnloadNetlibModule(void)
for (int i = netlibUser.getCount(); i > 0; i--)
NetlibCloseHandle((WPARAM)netlibUser[i-1], 0);
- netlibUser.destroy();
-
CloseHandle(hConnectionHeaderMutex);
- if (hConnectionOpenMutex) CloseHandle(hConnectionOpenMutex);
+ if (hConnectionOpenMutex)
+ CloseHandle(hConnectionOpenMutex);
DeleteCriticalSection(&csNetlibUser);
WSACleanup();
}
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index f0cf323776..44cfde41cd 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -447,7 +447,6 @@ void NetlibUnloadIeProxy(void)
for (i=0; i < proxyBypass.getCount(); i++)
mir_free(proxyBypass[i]);
- proxyBypass.destroy();
mir_free(abuf.lpszScriptBuffer);
CloseHandle(hIeProxyMutex);
diff --git a/src/modules/options/filter.h b/src/modules/options/filter.h
index afe04fc50b..0f51c84653 100644
--- a/src/modules/options/filter.h
+++ b/src/modules/options/filter.h
@@ -52,11 +52,7 @@ public:
~CPageKeywords()
{
for (int j = 0; j < _pageKeyWords.getCount(); j++)
- {
- TCHAR *data = _pageKeyWords[j];
- mir_free(data);
- }
- _pageKeyWords.destroy();
+ mir_free(_pageKeyWords[j]);
};
void AddKeyWord(TCHAR *ptKeyWord)
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index f61710c09b..07a29d6db4 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -866,8 +866,4 @@ void UnloadNewPluginsModule(void)
if (hPluginListHeap) HeapDestroy(hPluginListHeap);
hPluginListHeap = 0;
-
- pluginList.destroy();
- servicePlugins.destroy();
- clistPlugins.destroy();
}
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index aed4ae4c62..06c469845a 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -597,17 +597,13 @@ void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase)
void UnloadAccountsModule()
{
- int i;
-
if ( !bModuleInitialized) return;
- for (i = accounts.getCount()-1; i >= 0; i--) {
+ for (int i = accounts.getCount()-1; i >= 0; i--) {
PROTOACCOUNT* pa = accounts[ i ];
UnloadAccount(pa, false, false);
accounts.remove(i);
}
-
- accounts.destroy();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 3de239ebbb..d7d34a2275 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -733,14 +733,10 @@ void UnloadProtocolsModule()
mir_free(protos[i]->szName);
mir_free(protos[i]);
}
- protos.destroy();
}
for (int i=0; i < serviceItems.getCount(); i++)
mir_free(serviceItems[i]);
- serviceItems.destroy();
-
- filters.destroy();
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp
index ea50fdb760..95928b7aa3 100644
--- a/src/modules/skin/hotkeys.cpp
+++ b/src/modules/skin/hotkeys.cpp
@@ -399,7 +399,6 @@ void UnloadSkinHotkeys(void)
for (int i=0; i < hotkeys.getCount(); i++)
FreeHotkey(hotkeys[i]);
- hotkeys.destroy();
DestroyWindow(g_hwndHotkeyHost);
}
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp
index 1641e595aa..e6aa790610 100644
--- a/src/modules/skin/sounds.cpp
+++ b/src/modules/skin/sounds.cpp
@@ -468,6 +468,4 @@ void UnloadSkinSounds(void)
{
for (int i=0; i < arSounds.getCount(); i++)
arSounds[i].clear();
-
- arSounds.destroy();
}
diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp
index 2b88911990..ea6f8b9d76 100644
--- a/src/modules/srmm/statusicon.cpp
+++ b/src/modules/srmm/statusicon.cpp
@@ -216,7 +216,6 @@ int LoadSrmmModule()
void UnloadSrmmModule()
{
- arIcons.destroy();
NotifyEventHooks(hHookIconsChanged, NULL, NULL);
DestroyHookableEvent(hHookIconsChanged);
}
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp
index 6183dc151e..9cbd78c8fb 100644
--- a/src/modules/utils/timezones.cpp
+++ b/src/modules/utils/timezones.cpp
@@ -592,9 +592,3 @@ void InitTimeZones(void)
tmi.cbSize = sizeof(tmi);
GetTimeApi(0, (LPARAM)&tmi);
}
-
-void UninitTimeZones(void)
-{
- g_timezonesBias.destroy();
- g_timezones.destroy();
-}
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index 33c95995bd..823b981721 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -39,7 +39,6 @@ int InitBitmapFilter(void);
void InitXmlApi(void);
void InitTimeZones(void);
-void UninitTimeZones(void);
int InitCrypt(void);
void UninitCrypt(void);
@@ -492,5 +491,4 @@ void UnloadUtilsModule(void)
UninitCrypt();
FreeWindowList();
- UninitTimeZones();
}