[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/pim/akonadi/exchange/connector
From:       Robert Gruber <rgruber () users ! sourceforge ! net>
Date:       2012-01-14 10:15:38
Message-ID: 20120114101538.10A33AC891 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1273484 by rgruber:

Fixed a bug in the profile creation.
Profilenames where messed up most of the time.

 M  +12 -2     mapiconnector2.cpp  


--- trunk/playground/pim/akonadi/exchange/connector/mapiconnector2.cpp #1273483:1273484
@@ -1348,9 +1348,19 @@
 		return false;
 	}
 
-	const char *profile8 = profile.toUtf8();
+	// It seams that the QByteArray returned by QString::toUtf8() are not backed up.
+	// calling toUtf8() several times will destroy the data. Therefore I copy them
+	// all to temporary objects in order to preserve them throughout the whole method
+	QByteArray baProfile(profile.toUtf8());
+	QByteArray baUser(username.toUtf8());
+	QByteArray baPass(password.toUtf8());
+	QByteArray baDomain(domain.toUtf8());
+	QByteArray baServer(server.toUtf8());
 
-	if (MAPI_E_SUCCESS != CreateProfile(m_context, profile8, username.toUtf8(), password.toUtf8(), 0)) {
+	const char *profile8 = baProfile.constData();
+	qDebug() << "New profile is:"<<profile8;
+
+	if (MAPI_E_SUCCESS != CreateProfile(m_context, profile8, baUser.constData(), baPass.constData(), 0)) {
 		error() << "cannot create profile:" << mapiError();
 		return false;
 	}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic