summaryrefslogtreecommitdiff
path: root/src/modules
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/modules
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/modules')
-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
23 files changed, 9 insertions, 77 deletions
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();
}