[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/akonadi/exchange/connector
From: Shaheed Haque <srhaque () theiet ! org>
Date: 2013-04-16 22:32:31
Message-ID: 20130416223231.9FEFBAC87A () svn ! kde ! org
[Download RAW message or body]
SVN commit 1349765 by shaheed:
1. Fix crash on shutdown by using dynamic allocation
for m_store and m_nspiStore.
2. Also put a few experimental bits inside #defines.
M +38 -24 mapiconnector2.cpp
M +4 -4 mapiconnector2.h
--- trunk/playground/pim/akonadi/exchange/connector/mapiconnector2.cpp #1349764:1349765
@@ -55,6 +55,18 @@
#define DEBUG_RECIPIENTS 0
#endif
+#ifndef DEBUG_PUBLIC_FOLDERS
+#define DEBUG_PUBLIC_FOLDERS 0
+#endif
+
+#ifndef DEBUG_NOTIFICATIONS
+#define DEBUG_NOTIFICATIONS 0
+#endif
+
+#ifndef DEBUG_MAPI
+#define DEBUG_MAPI 1
+#endif
+
#define STR(def) \
case def: return QString::fromLatin1(#def)
@@ -246,8 +258,10 @@
m_session(0),
m_notifier(0)
{
- mapi_object_init(&m_store);
- mapi_object_init(&m_nspiStore);
+ m_store = allocate<mapi_object_t>();
+ m_nspiStore = allocate<mapi_object_t>();
+ mapi_object_init(m_store);
+ mapi_object_init(m_nspiStore);
}
MapiConnector2::~MapiConnector2()
@@ -255,11 +269,11 @@
delete m_notifier;
// TODO The calls to tidy up m_nspiStore seem to break things.
if (m_session) {
- //Logoff(&m_nspiStore);
- Logoff(&m_store);
+ //Logoff(m_nspiStore);
+ Logoff(m_store);
}
- //mapi_object_release(&m_nspiStore);
- mapi_object_release(&m_store);
+ //mapi_object_release(m_nspiStore);
+ mapi_object_release(m_store);
}
QDebug MapiConnector2::debug() const
@@ -275,27 +289,17 @@
// NSPI-based assets.
if ((PublicRoot <= folderType) && (folderType <= PublicNNTPArticle)) {
- if (MAPI_E_SUCCESS != GetDefaultPublicFolder(&m_nspiStore, &id->second, folderType)) {
+ if (MAPI_E_SUCCESS != GetDefaultPublicFolder(m_nspiStore, &id->second, folderType)) {
error() << "cannot get default public folder: %1" << folderType << mapiError();
return false;
}
id->first = 0;
id->m_provider = MapiId::NSPI;
-#if 0
- if (MAPI_E_SUCCESS != SetMAPIDebugLevel(m_context, 9)) {
- error() << "cannot set debug level" << mapiError();
- return false;
- }
- if (MAPI_E_SUCCESS != SetMAPIDumpData(m_context, true)) {
- error() << "cannot set dump data" << mapiError();
- return false;
- }
-#endif
return true;
}
// EMSDB-based assets.
- if (MAPI_E_SUCCESS != GetDefaultFolder(&m_store, &id->second, folderType)) {
+ if (MAPI_E_SUCCESS != GetDefaultFolder(m_store, &id->second, folderType)) {
error() << "cannot get default folder: %1" << folderType << mapiError();
return false;
}
@@ -392,21 +396,31 @@
error() << "cannot logon using profile" << profile << mapiError();
return false;
}
- if (MAPI_E_SUCCESS != OpenMsgStore(m_session, &m_store)) {
+ if (MAPI_E_SUCCESS != OpenMsgStore(m_session, m_store)) {
error() << "cannot open message store" << mapiError();
return false;
}
- if (MAPI_E_SUCCESS != OpenPublicFolder(m_session, &m_nspiStore)) {
+#if (DEBUG_PUBLIC_FOLDERS)
+ if (MAPI_E_SUCCESS != OpenPublicFolder(m_session, m_nspiStore)) {
error() << "cannot open public folder" << mapiError();
- // TODO: This does not work, and returning false at this point just breaks
- // everything...
- //return false;
+ return false;
}
+#endif
+#if (DEBUG_MAPI)
+ if (MAPI_E_SUCCESS != SetMAPIDebugLevel(m_context, 9)) {
+ error() << "cannot set debug level" << mapiError();
+ return false;
+ }
+ if (MAPI_E_SUCCESS != SetMAPIDumpData(m_context, true)) {
+ error() << "cannot set dump data" << mapiError();
+ return false;
+ }
+#endif
// Get rid of any existing notifier and create a new one.
// TODO Wait for a version of libmapi that has asingle parameter here.
+#if (DEBUG_NOTIFICATIONS)
#if 0
-#if 0
if (MAPI_E_SUCCESS != RegisterNotification(m_session)) {
#else
if (MAPI_E_SUCCESS != RegisterNotification(m_session, 0)) {
--- trunk/playground/pim/akonadi/exchange/connector/mapiconnector2.h #1349764:1349765
@@ -446,9 +446,9 @@
switch (id.m_provider)
{
case MapiId::EMSDB:
- return &m_store;
+ return m_store;
case MapiId::NSPI:
- return &m_nspiStore;
+ return m_nspiStore;
default:
return 0;
}
@@ -467,8 +467,8 @@
mapi_object_t openFolder(mapi_id_t folderID);
mapi_session *m_session;
- mapi_object_t m_store;
- mapi_object_t m_nspiStore;
+ mapi_object_t *m_store;
+ mapi_object_t *m_nspiStore;
class QSocketNotifier *m_notifier;
virtual QDebug debug() const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic