summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_db_int.h1
-rw-r--r--plugins/Db3x_mmap/src/init.cpp2
-rw-r--r--plugins/Import/src/import.cpp1
-rw-r--r--src/mir_app/src/miranda.h1
-rw-r--r--src/mir_core/src/db.cpp4
5 files changed, 5 insertions, 4 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h
index b549291385..d53fc6b2bd 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -235,6 +235,7 @@ EXTERN_C MIR_CORE_DLL(DBCachedContact*) db_get_contact(MCONTACT);
// Database list's functions
EXTERN_C MIR_CORE_DLL(MDatabaseCommon*) db_get_current(void);
+EXTERN_C MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db);
// registers a database plugin
EXTERN_C MIR_APP_DLL(void) RegisterDatabasePlugin(DATABASELINK *pDescr);
diff --git a/plugins/Db3x_mmap/src/init.cpp b/plugins/Db3x_mmap/src/init.cpp
index 587b79253b..c2860ecfef 100644
--- a/plugins/Db3x_mmap/src/init.cpp
+++ b/plugins/Db3x_mmap/src/init.cpp
@@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-EXTERN_C MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db);
-
int hLangpack;
static PLUGININFOEX pluginInfo =
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 08ba83bee9..752400ecc8 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -1137,6 +1137,7 @@ void MirandaImport(HWND hdlg)
// Restore database writing mode
dstDb->SetCacheSafetyMode(TRUE);
+ db_setCurrent(dstDb);
// Clean up before exit
delete srcDb;
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index e1674f4b06..645fd36013 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -201,5 +201,4 @@ extern "C"
{
MIR_CORE_DLL(int) Langpack_MarkPluginLoaded(PLUGININFOEX* pInfo);
MIR_CORE_DLL(int) GetSubscribersCount(struct THook *hHook);
- MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db);
};
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index 04efa68510..69e998c53c 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -437,9 +437,11 @@ MIR_CORE_DLL(MCONTACT) db_find_next(MCONTACT hContact, const char *szProto)
return (currDb == nullptr) ? NULL : currDb->FindNextContact(hContact, szProto);
}
-extern "C" MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db)
+MIR_CORE_DLL(void) db_setCurrent(MDatabaseCommon *_db)
{
currDb = _db;
+ if (currDb == nullptr)
+ return;
// try to get the langpack's name from a profile
ptrW langpack(db_get_wsa(NULL, "Langpack", "Current"));