summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-21 18:06:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-21 18:09:19 +0300
commitf7001757a832e948645713a94739f66b07d5f2c1 (patch)
tree8accc928f2eadf5940a336f9be639b3f27e921a6 /plugins
parent6119b7865f7890d9bfc627d35d8e1262c2690e9c (diff)
DATABASELINK::Unload method replaced with the virtual destructor of MDatabaseCommon
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbintf.cpp2
-rw-r--r--plugins/Db3x_mmap/src/init.cpp9
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp1
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp10
-rw-r--r--plugins/Import/src/dbrw/dbrw.cpp11
-rw-r--r--plugins/Import/src/import.cpp5
6 files changed, 10 insertions, 28 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp
index dc775b82b1..be36e4bdd7 100644
--- a/plugins/Db3x_mmap/src/dbintf.cpp
+++ b/plugins/Db3x_mmap/src/dbintf.cpp
@@ -59,6 +59,8 @@ CDb3Mmap::CDb3Mmap(const wchar_t *tszFileName, int iMode) :
CDb3Mmap::~CDb3Mmap()
{
+ g_Dbs.remove(this);
+
// destroy modules
HeapDestroy(m_hModHeap);
diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp
index 21feb9ed49..a452a43321 100644
--- a/plugins/Db3x_mmap/src/init.cpp
+++ b/plugins/Db3x_mmap/src/init.cpp
@@ -67,6 +67,7 @@ static int grokHeader(const wchar_t *profile)
// returns 0 if all the APIs are injected otherwise, 1
static MIDatabase* LoadDatabase(const wchar_t *profile, BOOL bReadOnly)
+static MDatabaseCommon* LoadDatabase(const wchar_t *profile, BOOL bReadOnly)
{
// set the memory, lists & UTF8 manager
mir_getLP(&pluginInfo);
@@ -79,13 +80,6 @@ static MIDatabase* LoadDatabase(const wchar_t *profile, BOOL bReadOnly)
return db.release();
}
-static int UnloadDatabase(MIDatabase *db)
-{
- g_Dbs.remove((CDb3Mmap*)db);
- delete (CDb3Mmap*)db;
- return 0;
-}
-
MIDatabaseChecker* CheckDb(const wchar_t *profile, int *error)
{
std::auto_ptr<CDb3Mmap> db(new CDb3Mmap(profile, DBMODE_READONLY));
@@ -108,7 +102,6 @@ static DATABASELINK dblink =
makeDatabase,
grokHeader,
LoadDatabase,
- UnloadDatabase,
CheckDb
};
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index e74f266248..e9d0b33ad9 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -39,6 +39,7 @@ CDbxMDBX::CDbxMDBX(const TCHAR *tszFileName, int iMode) :
CDbxMDBX::~CDbxMDBX()
{
+ g_Dbs.remove(this);
mdbx_env_close(m_env);
DestroyServiceFunction(hService);
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index bfb04f23ae..3e7153e6db 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -62,7 +62,7 @@ static int grokHeader(const TCHAR *profile)
}
// returns 0 if all the APIs are injected otherwise, 1
-static MIDatabase* LoadDatabase(const TCHAR *profile, BOOL bReadOnly)
+static MDatabaseCommon* LoadDatabase(const TCHAR *profile, BOOL bReadOnly)
{
// set the memory, lists & UTF8 manager
mir_getLP(&pluginInfo);
@@ -75,13 +75,6 @@ static MIDatabase* LoadDatabase(const TCHAR *profile, BOOL bReadOnly)
return db.release();
}
-static int UnloadDatabase(MIDatabase *db)
-{
- g_Dbs.remove((CDbxMDBX*)db);
- delete (CDbxMDBX*)db;
- return 0;
-}
-
MIDatabaseChecker* CheckDb(const TCHAR *profile, int *error)
{
std::unique_ptr<CDbxMDBX> db(new CDbxMDBX(profile, DBMODE_READONLY));
@@ -101,7 +94,6 @@ static DATABASELINK dblink =
makeDatabase,
grokHeader,
LoadDatabase,
- UnloadDatabase,
CheckDb
};
diff --git a/plugins/Import/src/dbrw/dbrw.cpp b/plugins/Import/src/dbrw/dbrw.cpp
index 728fafe9ff..b5ed672bdb 100644
--- a/plugins/Import/src/dbrw/dbrw.cpp
+++ b/plugins/Import/src/dbrw/dbrw.cpp
@@ -77,19 +77,13 @@ static int dbrw_grokHeader(const wchar_t *profile)
return rc;
}
-static MIDatabase* dbrw_Load(const wchar_t *profile, BOOL)
+static MDatabaseCommon* dbrw_Load(const wchar_t *profile, BOOL)
{
CDbxSQLite *db = new CDbxSQLite();
db->Open(profile);
return db;
}
-static int dbrw_Unload(MIDatabase *db)
-{
- delete (CDbxSQLite*)db;
- return 0;
-}
-
static DATABASELINK dblink =
{
sizeof(DATABASELINK),
@@ -97,8 +91,7 @@ static DATABASELINK dblink =
L"dbx SQLite driver",
dbrw_makeDatabase,
dbrw_grokHeader,
- dbrw_Load,
- dbrw_Unload
+ dbrw_Load
};
void RegisterDbrw()
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 7a133ae62b..76ff58be8e 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -68,7 +68,8 @@ static LIST<DBCachedContact> arMetas(10);
static HWND hdlgProgress;
static DWORD nDupes, nContactsCount, nMessagesCount, nGroupsCount, nSkippedEvents, nSkippedContacts;
-static MIDatabase *srcDb, *dstDb;
+static MDatabaseCommon *srcDb;
+static MIDatabase *dstDb;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1090,7 +1091,7 @@ void MirandaImport(HWND hdlg)
dstDb->SetCacheSafetyMode(TRUE);
// Clean up before exit
- dblink->Unload(srcDb);
+ delete srcDb;
// Stop timer
dwTimer = time(nullptr) - dwTimer;