diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 14:26:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 14:26:23 +0300 |
commit | 524d1c7186eca3f0a4da08548eeb919785227101 (patch) | |
tree | 8e316d19033ca0c0465b0f92b4ef3c89c1b23427 | |
parent | 8f6650583ad1d12a081a1676275d8f527af33351 (diff) |
hPluginListHeap - useless windows heap removed
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/plugins.h | 33 |
2 files changed, 19 insertions, 27 deletions
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 1771bb117f..4497d195bd 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -57,7 +57,6 @@ static BOOL bModuleInitialized = FALSE; wchar_t mirandabootini[MAX_PATH];
static DWORD mirandaVersion;
static int sttFakeID = -100;
-static HANDLE hPluginListHeap = nullptr;
static int askAboutIgnoredPlugins;
pluginEntry *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
@@ -339,7 +338,9 @@ void Plugin_Uninit(pluginEntry *p) if (p == plugin_crshdmp)
plugin_crshdmp = nullptr;
+
pluginList.remove(p);
+ mir_free(p);
}
int Plugin_UnloadDyn(pluginEntry *p)
@@ -374,14 +375,13 @@ int Plugin_UnloadDyn(pluginEntry *p) NotifyFastHook(hevUnloadModule, (WPARAM)p->bpi.pluginInfo, (LPARAM)p->bpi.hInst);
- Plugin_Uninit(p);
-
// mark default plugins to be loaded
if (!p->bIsCore)
for (auto &it : pluginDefault)
if (it.pImpl == p)
it.pImpl = nullptr;
+ Plugin_Uninit(p);
return TRUE;
}
@@ -422,7 +422,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path)
{
- pluginEntry *p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
+ pluginEntry *p = (pluginEntry*)mir_calloc(sizeof(pluginEntry));
wcsncpy_s(p->pluginname, tszFileName, _TRUNCATE);
// add it to the list anyway
@@ -866,7 +866,6 @@ int LoadNewPluginsModuleInfos(void) LoadPluginOptions();
- hPluginListHeap = HeapCreate(HEAP_NO_SERIALIZE, 0, 0);
mirandaVersion = Miranda_GetVersion();
RegisterModule(g_hInst);
@@ -920,8 +919,4 @@ void UnloadNewPluginsModule(void) for (auto &it : pluginList.rev_iter())
Plugin_Uninit(it);
-
- if (hPluginListHeap)
- HeapDestroy(hPluginListHeap);
- hPluginListHeap = nullptr;
}
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h index d860df1a67..f28f7fa5d8 100644 --- a/src/mir_app/src/plugins.h +++ b/src/mir_app/src/plugins.h @@ -31,24 +31,21 @@ struct BASIC_PLUGIN_INFO struct pluginEntry
{
wchar_t pluginname[64];
- union {
- unsigned int pclass;
- struct {
- bool bFailed : 1; // not a valid plugin, or API is invalid, pluginname is valid
- bool bOk : 1; // plugin should be loaded, if DB means nothing
- bool bLoaded : 1; // Load(void) has been called, Unload() should be called.
- bool bStopped : 1; // wasn't loaded cos plugin name not on white list
-
- bool bIsCore : 1; // a plugin from the /Core directory
- bool bIsService : 1; // has Service Mode implementation
- bool bIsLast : 1; // this plugin should be unloaded after everything else
-
- bool bHasBasicApi : 1; // has Load, Unload, MirandaPluginInfo() -> PLUGININFO seems valid, this dll is in memory.
- bool bIsProtocol : 1; // protocol module
- bool bIsDatabase : 1; // has DatabasePluginInfo() and is valid as can be, and PCLASS_BASICAPI has to be set too
- bool bIsClist : 1; // a CList implementation
- bool bIsCrypto : 1; // crypto provider
- };
+ struct {
+ bool bFailed : 1; // not a valid plugin, or API is invalid, pluginname is valid
+ bool bOk : 1; // plugin should be loaded, if DB means nothing
+ bool bLoaded : 1; // Load(void) has been called, Unload() should be called.
+ bool bStopped : 1; // wasn't loaded cos plugin name not on white list
+
+ bool bIsCore : 1; // a plugin from the /Core directory
+ bool bIsService : 1; // has Service Mode implementation
+ bool bIsLast : 1; // this plugin should be unloaded after everything else
+
+ bool bHasBasicApi : 1; // has Load, Unload, MirandaPluginInfo() -> PLUGININFO seems valid, this dll is in memory.
+ bool bIsProtocol : 1; // protocol module
+ bool bIsDatabase : 1; // has DatabasePluginInfo() and is valid as can be, and PCLASS_BASICAPI has to be set too
+ bool bIsClist : 1; // a CList implementation
+ bool bIsCrypto : 1; // crypto provider
};
int hLangpack;
|