summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2012-07-20 10:04:59 +1000
committerQt Continuous Integration System <qt-info@nokia.com>2012-07-20 10:04:59 +1000
commit29cf93e87913184fb45dff4089756a1315624c02 (patch)
treecab523842c45c9104e62ad53f29e55cae3d95651
parentc6e5e19ffa3c63f7a13b56b3602daca7c443fb62 (diff)
parentf34601f2ffe23dca249e1e0ffc7feb30e2a436db (diff)
Merge branch 'master' of git://scm.dev.nokia.troll.no/qtmobility/qtm-connectivity
* 'master' of git://scm.dev.nokia.troll.no/qtmobility/qtm-connectivity: Fix QGalleryQueryRequest::setMetaData does not work on Symbian Fix messaging engine (CMTMEngine) cleanup stack usage on Symbian Attachment file name unicode support to Symbian platform Make clear that saving of partial new contacts is possible Symbian error handling improved. bluetooth: fix sending memory object through QBluetoothTransferManager Fixed build failures Improve landmark coordinate validation in landmarkbrowser example Improve landmark coordinate validation in landmarkbrowser example Fix for pixi crash RC-969917 Handling errors for apps with no caps
-rw-r--r--examples/landmarkbrowser/landmarkadddialog.cpp4
-rw-r--r--plugins/multimedia/symbian/videooutput/s60videobuffer.h2
-rw-r--r--plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.cpp6
-rw-r--r--plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.h2
-rw-r--r--src/connectivity/bluetooth/qbluetoothtransferreply_symbian.cpp52
-rw-r--r--src/connectivity/bluetooth/qbluetoothtransferreply_symbian_p.h2
-rw-r--r--src/contacts/qcontactmanager.cpp2
-rw-r--r--src/contacts/requests/qcontactsaverequest.cpp2
-rw-r--r--src/gallery/symbian/qmdegalleryresultset.cpp29
-rw-r--r--src/gallery/symbian/qmdesession.cpp8
-rw-r--r--src/gallery/symbian/qmdesession_p.h1
-rw-r--r--src/messaging/qfsengine_symbian.cpp31
-rw-r--r--src/messaging/qmessagecontentcontainer.cpp2
-rw-r--r--src/messaging/qmtmengine_symbian.cpp26
-rw-r--r--src/serviceframework/ipc/objectendpoint.cpp130
-rw-r--r--src/serviceframework/ipc/objectendpoint_p.h32
-rw-r--r--src/serviceframework/ipc/proxyobject.cpp13
-rw-r--r--src/serviceframework/ipc/qremoteserviceregister_s60.cpp64
-rw-r--r--src/serviceframework/ipc/qremoteserviceregister_s60_p.h6
-rw-r--r--src/serviceframework/serviceframework.pro1
-rw-r--r--src/systeminfo/symbian/telephonyinfo_s60.cpp12
21 files changed, 334 insertions, 93 deletions
diff --git a/examples/landmarkbrowser/landmarkadddialog.cpp b/examples/landmarkbrowser/landmarkadddialog.cpp
index 08349bfbb6..10b380fb43 100644
--- a/examples/landmarkbrowser/landmarkadddialog.cpp
+++ b/examples/landmarkbrowser/landmarkadddialog.cpp
@@ -110,14 +110,14 @@ void LandmarkAddDialog::accept()
{
bool ok;
double latitude = this->latitudeLineEdit->text().toDouble(&ok);
- if (!ok || latitude < -90.0 || latitude > 90.0) {
+ if (!ok || latitude < -90.0 || latitude > 90.0 || !(latitude == latitude)) {
QMessageBox::warning(this, "Invalid latitude", "Latitude must be between -90 and 90 degrees",
QMessageBox::Ok, QMessageBox::NoButton);
return;
}
double longitude = this->longitudeLineEdit->text().toDouble(&ok);
- if (!ok || longitude < -180.0 || longitude > 180.0) {
+ if (!ok || longitude < -180.0 || longitude > 180.0 || !(longitude == longitude)) {
QMessageBox::warning(this, "Invalid longitude", "Longitude must be between -180 and 180 degrees",
QMessageBox::Ok, QMessageBox::NoButton);
return;
diff --git a/plugins/multimedia/symbian/videooutput/s60videobuffer.h b/plugins/multimedia/symbian/videooutput/s60videobuffer.h
index 032809b419..e9dec23338 100644
--- a/plugins/multimedia/symbian/videooutput/s60videobuffer.h
+++ b/plugins/multimedia/symbian/videooutput/s60videobuffer.h
@@ -42,7 +42,7 @@
#ifndef S60VIDEOBUFFER_H
#define S60VIDEOBUFFER_H
-#include <QtMultimediaKit/QAbstractVideoBuffer>
+#include <qabstractvideobuffer.h>
#include <egl/eglext.h>
#ifndef QT_NO_OPENGL
diff --git a/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.cpp b/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.cpp
index 29f3ef39c2..70d4d9838b 100644
--- a/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.cpp
+++ b/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.cpp
@@ -44,9 +44,9 @@
#include "s60videobuffer.h"
#include "s60videoeglrenderercontrol.h"
#include <EGL/egl.h>
-#include <QtMultimediaKit/QAbstractVideoSurface>
-#include <QtMultimediaKit/QVideoFrame>
-#include <QtMultimediaKit/QVideoSurfaceFormat>
+#include <qabstractvideosurface.h>
+#include <qvideoframe.h>
+#include <qvideosurfaceformat.h>
#ifdef VIDEOOUTPUT_MEASURE_FRAMERATE
#include "s60videoframerate.h"
diff --git a/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.h b/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.h
index 3cfc20414a..d291294058 100644
--- a/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.h
+++ b/plugins/multimedia/symbian/videooutput/s60videoeglrenderercontrol.h
@@ -43,7 +43,7 @@
#define S60VIDEOEGLRENDERERCONTROL_H
#include <QtCore/QSize>
-#include <QtMultimediaKit/QVideoRendererControl>
+#include <qvideorenderercontrol.h>
#include <egl/eglext.h>
#include <graphics/surface.h>
diff --git a/src/connectivity/bluetooth/qbluetoothtransferreply_symbian.cpp b/src/connectivity/bluetooth/qbluetoothtransferreply_symbian.cpp
index 4853cba74f..76ff11a559 100644
--- a/src/connectivity/bluetooth/qbluetoothtransferreply_symbian.cpp
+++ b/src/connectivity/bluetooth/qbluetoothtransferreply_symbian.cpp
@@ -58,6 +58,7 @@ QBluetoothTransferReplySymbian::QBluetoothTransferReplySymbian(QIODevice *input,
: QBluetoothTransferReply(parent)
, CActive(EPriorityStandard)
, m_source(input)
+ , m_tempfilename(QString())
, m_discoveryAgent(NULL)
, m_running(false)
, m_finished(false)
@@ -90,6 +91,8 @@ QBluetoothTransferReplySymbian::~QBluetoothTransferReplySymbian()
delete m_discoveryAgent;
delete m_object;
delete m_client;
+ if (!m_tempfilename.isEmpty())
+ QFile::remove(m_tempfilename);
}
void QBluetoothTransferReplySymbian::setAddress(const QBluetoothAddress &address)
@@ -197,6 +200,10 @@ void QBluetoothTransferReplySymbian::abort()
m_client = NULL;
delete m_object;
m_object = NULL;
+ if (!m_tempfilename.isEmpty()) {
+ QFile::remove(m_tempfilename);
+ m_tempfilename = QString();
+ }
}
QBluetoothTransferReply::TransferError QBluetoothTransferReplySymbian::error() const
@@ -241,10 +248,14 @@ void QBluetoothTransferReplySymbian::RunL()
m_fileSize = info.size();
filename = QDir::toNativeSeparators(info.absoluteFilePath());
} else {
- if (copyToTempFile(m_tempfile, m_source)) {
- QFileInfo info(*m_tempfile);
- m_fileSize = info.size();
- filename = QDir::toNativeSeparators(info.absoluteFilePath());
+ QTemporaryFile tempfile(QLatin1String("BT"));
+ m_tempfilename = QString();
+ if (tempfile.open() && copyToTempFile(&tempfile, m_source)) {
+ QFileInfo info(tempfile);
+ m_fileSize = info.size();
+ m_tempfilename = QDir::toNativeSeparators(info.absoluteFilePath());
+ filename = m_tempfilename;
+ tempfile.setAutoRemove(false); // the file will be deleted when sending is complete
} else {
m_state = EDisconnecting;
disconnect();
@@ -279,18 +290,19 @@ void QBluetoothTransferReplySymbian::sendObject(QString filename)
TRAPD(err, m_object = CObexFileObject::NewL());
if (!err) {
TPtrC16 str(reinterpret_cast<const TUint16*>(filename.utf16()));
- TRAPD(error, m_object->InitFromFileL( str ));
- if (!error) {
- m_client->Put( *m_object, iStatus );
- m_timer->start(1000);
- emit uploadProgress(0, m_fileSize);
- SetActive();
- } else {
- qDebug() << "Error in" << __FUNCTION__ << error;
- m_error = error == KErrNotFound ? FileNotFoundError: UnknownError;
- disconnect();
- emit finished(this);
- }
+ TRAP(err, m_object->InitFromFileL(str));
+ }
+
+ if (!err) {
+ m_client->Put( *m_object, iStatus );
+ m_timer->start(1000);
+ emit uploadProgress(0, m_fileSize);
+ SetActive();
+ } else {
+ qDebug() << "Error in" << __FUNCTION__ << err;
+ m_error = err == KErrNotFound ? FileNotFoundError: UnknownError;
+ disconnect();
+ emit finished(this);
}
}
@@ -301,6 +313,10 @@ void QBluetoothTransferReplySymbian::disconnect()
m_timer->stop();
delete m_object;
m_object = NULL;
+ if (!m_tempfilename.isEmpty()) {
+ QFile::remove(m_tempfilename);
+ m_tempfilename = QString();
+ }
m_client->Disconnect( iStatus );
SetActive();
}
@@ -309,10 +325,12 @@ void QBluetoothTransferReplySymbian::disconnect()
bool QBluetoothTransferReplySymbian::copyToTempFile(QIODevice *to, QIODevice *from)
{
char *block = new char[4096];
-
+ from->seek(0);
+
while (!from->atEnd()) {
int size = from->read(block, 4096);
if (size != to->write(block, size)) {
+ delete[] block;
return false;
}
}
diff --git a/src/connectivity/bluetooth/qbluetoothtransferreply_symbian_p.h b/src/connectivity/bluetooth/qbluetoothtransferreply_symbian_p.h
index 894bc60a0a..b9ef8ea140 100644
--- a/src/connectivity/bluetooth/qbluetoothtransferreply_symbian_p.h
+++ b/src/connectivity/bluetooth/qbluetoothtransferreply_symbian_p.h
@@ -117,7 +117,7 @@ private slots:
private:
QIODevice *m_source;
- QTemporaryFile *m_tempfile;
+ QString m_tempfilename;
QBluetoothAddress m_address;
QBluetoothServiceDiscoveryAgent* m_discoveryAgent;
diff --git a/src/contacts/qcontactmanager.cpp b/src/contacts/qcontactmanager.cpp
index 98a285882e..b8c417c880 100644
--- a/src/contacts/qcontactmanager.cpp
+++ b/src/contacts/qcontactmanager.cpp
@@ -647,7 +647,7 @@ bool QContactManager::saveContacts(QList<QContact>* contacts, QMap<int, QContact
Returns true if the contacts were saved successfully, otherwise false.
This function accepts a \a definitionMask, which specifies which details of
- the contacts should be updated. Details with definition names not included in
+ the contacts should be added or updated. Details with definition names not included in
the definitionMask will not be updated or added.
The deprecated \a errorMap parameter can be supplied to store per-input errors in.
diff --git a/src/contacts/requests/qcontactsaverequest.cpp b/src/contacts/requests/qcontactsaverequest.cpp
index 56ab16d1a0..9e2efcfc16 100644
--- a/src/contacts/requests/qcontactsaverequest.cpp
+++ b/src/contacts/requests/qcontactsaverequest.cpp
@@ -126,7 +126,7 @@ QMap<int, QContactManager::Error> QContactSaveRequest::errorMap() const
/*!
Set the list of definitions to restrict saving to \a definitionMask. This allows you to perform
- partial save (and remove) operations on existing contacts.
+ partial save (and remove) operations on new and existing contacts.
If \a definitionMask is empty (the default), no restrictions will apply, and the passed
in contacts will be saved as is. Otherwise, only details whose definitions are in
diff --git a/src/gallery/symbian/qmdegalleryresultset.cpp b/src/gallery/symbian/qmdegalleryresultset.cpp
index 0eb2d88a80..e444a40e4f 100644
--- a/src/gallery/symbian/qmdegalleryresultset.cpp
+++ b/src/gallery/symbian/qmdegalleryresultset.cpp
@@ -177,23 +177,18 @@ QVariant QMDEGalleryResultSet::metaData(int key) const
bool QMDEGalleryResultSet::setMetaData(int key, const QVariant &value)
{
- bool ret = false;
-
- TRAPD( err, QDocumentGalleryMDSUtility::SetMetaDataFieldL(
- m_itemArray[m_cursorPosition], value, key) );
- if (err) {
- return false;
- } else {
- if (ret) {
- TRAP( err, m_session->CommitObjectL( *m_itemArray[m_cursorPosition] ) );
- if (err) {
- return false;
- } else {
- return true;
- }
- }
- }
- return false;
+ TRAPD( err,
+ CMdEObject* object = m_session->OpenObjectL(m_itemArray[m_cursorPosition]->Id(),
+ m_itemArray[m_cursorPosition]->Def());
+ if (!object)
+ User::Leave(KErrNotFound);
+ CleanupStack::PushL(object);
+ QDocumentGalleryMDSUtility::SetMetaDataFieldL(object, value, key);
+ m_session->CommitObjectL(*object);
+ CleanupStack::PopAndDestroy(object);
+ );
+
+ return err == KErrNone ? true: false;
}
int QMDEGalleryResultSet::currentIndex() const
diff --git a/src/gallery/symbian/qmdesession.cpp b/src/gallery/symbian/qmdesession.cpp
index cc5db8cf82..888ca6be1d 100644
--- a/src/gallery/symbian/qmdesession.cpp
+++ b/src/gallery/symbian/qmdesession.cpp
@@ -108,6 +108,14 @@ CMdEObject* QMdeSession::GetFullObjectL(const unsigned int id)
return NULL;
}
+CMdEObject* QMdeSession::OpenObjectL( const unsigned int id, CMdEObjectDef& objectDef )
+{
+ if (m_cmdeSession)
+ return m_cmdeSession->OpenObjectL(id, objectDef);
+ else
+ return NULL;
+}
+
void QMdeSession::CommitObjectL( CMdEObject& object )
{
if (m_cmdeSession)
diff --git a/src/gallery/symbian/qmdesession_p.h b/src/gallery/symbian/qmdesession_p.h
index e241209c48..fd850842b4 100644
--- a/src/gallery/symbian/qmdesession_p.h
+++ b/src/gallery/symbian/qmdesession_p.h
@@ -95,6 +95,7 @@ public: // From MMdESessionObserver
CMdEObject* GetFullObjectL( const unsigned int id );
+ CMdEObject* OpenObjectL( const unsigned int id, CMdEObjectDef& objectDef );
void CommitObjectL( CMdEObject& object );
CMdEObjectQuery* NewObjectQueryL(MMdEQueryObserver *observer,
diff --git a/src/messaging/qfsengine_symbian.cpp b/src/messaging/qfsengine_symbian.cpp
index 1b5714a793..63cbcaa47a 100644
--- a/src/messaging/qfsengine_symbian.cpp
+++ b/src/messaging/qfsengine_symbian.cpp
@@ -131,6 +131,25 @@ CFSEngine::CFSEngine()
,m_messageStorePrivateSingleton(0)
#endif
{
+ m_factory = 0;
+ TRAPD(err, {
+ m_factory = CEmailInterfaceFactory::NewL();
+ m_ifPtr = m_factory->InterfaceL(KEmailClientApiInterface);
+ } );
+
+ // Check that getting email api interface was successful.
+ // Otherwise throwing exception.
+ if( err != KErrNone ) {
+ if( m_factory ) {
+ delete m_factory;
+ m_factory = 0;
+ }
+ // This is always throwing
+ qt_symbian_throwIfError(err);
+ }
+
+ m_clientApi = static_cast<MEmailClientApi*>(m_ifPtr);
+
if (QCoreApplication::instance() && QCoreApplication::instance()->thread() == QThread::currentThread()) {
// Make sure that application/main thread specific FsEngine will be cleaned up
// when application event loop quits
@@ -142,14 +161,6 @@ CFSEngine::CFSEngine()
qAddPostRoutine(CFSEngine::cleanup);
}
- TRAPD(err, {
- m_factory = CEmailInterfaceFactory::NewL();
- m_ifPtr = m_factory->InterfaceL(KEmailClientApiInterface);
- });
-
- Q_UNUSED(err);
- m_clientApi = static_cast<MEmailClientApi*>(m_ifPtr);
-
if (QCoreApplication::instance() && QCoreApplication::instance()->thread() == QThread::currentThread()) {
TRAP_IGNORE(setPluginObserversL());
}
@@ -2598,7 +2609,7 @@ void CFSEngine::addMessagePartsToQMessage(QMessage& message, MEmailMessage& mEma
TPtrC fName(KNullDesC);
TRAPD(err, fName.Set(attachments[i]->FileNameL()));
if (err == KErrNone) {
- fileName = QString::fromUtf16(fName.Ptr(), fName.Length()).toLocal8Bit();
+ fileName = QString::fromUtf16(fName.Ptr(), fName.Length()).toUtf8();
}
QByteArray mimeHeader = QString::fromUtf16(attachments[i]->ContentType().Ptr(),
attachments[i]->ContentType().Length()).toAscii();
@@ -2748,7 +2759,7 @@ void CFSEngine::addContentToQMessage(QMessage& message, const MEmailMessageConte
TPtrC fName(KNullDesC);
TRAPD(err, fName.Set(pAttachment->FileNameL()));
if (err == KErrNone) {
- fileName = QString::fromUtf16(fName.Ptr(), fName.Length()).toLocal8Bit();
+ fileName = QString::fromUtf16(fName.Ptr(), fName.Length()).toUtf8();
}
QByteArray mimeHeader = QString::fromUtf16(pAttachment->ContentType().Ptr(),
pAttachment->ContentType().Length()).toAscii();
diff --git a/src/messaging/qmessagecontentcontainer.cpp b/src/messaging/qmessagecontentcontainer.cpp
index 069f958638..31ed91a3f8 100644
--- a/src/messaging/qmessagecontentcontainer.cpp
+++ b/src/messaging/qmessagecontentcontainer.cpp
@@ -161,6 +161,8 @@ QTM_BEGIN_NAMESPACE
Returns the suggested filename for the attachment, when defined;
otherwise an empty array is returned.
+
+ On Symbian platform returned file name is UTF-8 encoded.
The default is an empty array.
\since 1.0
diff --git a/src/messaging/qmtmengine_symbian.cpp b/src/messaging/qmtmengine_symbian.cpp
index baae8dcff9..6f61d540bc 100644
--- a/src/messaging/qmtmengine_symbian.cpp
+++ b/src/messaging/qmtmengine_symbian.cpp
@@ -2840,7 +2840,7 @@ void CMTMEngine::storeMMSL(QMessage &message)
attachment.Size(fileSize);
TInt maxFileSize = 600000;
if (fileSize > maxFileSize){
- return;
+ User::Leave(KErrTooBig);
}
HBufC8* pFileContent = HBufC8::NewL(fileSize);
@@ -2853,15 +2853,9 @@ void CMTMEngine::storeMMSL(QMessage &message)
RFs fileServer;
User::LeaveIfError(fileServer.Connect());
CleanupClosePushL(fileServer);
- TInt err = file2.Temp(fileServer,iPath,tempFileName,EFileWrite);
- if (err != KErrNone){
- return;
- }
+ User::LeaveIfError(file2.Temp(fileServer,iPath,tempFileName,EFileWrite));
CleanupClosePushL(file2);
- err = file2.Write(*pFileContent);
- if (err != KErrNone){
- return;
- }
+ User::LeaveIfError(file2.Write(*pFileContent));
file2.Close();
User::LeaveIfError(file2.Open(FsSession(),tempFileName, EFileShareAny|EFileRead));
// Mime header
@@ -3131,7 +3125,7 @@ void CMTMEngine::updateMMSL(QMessage &message)
attachment.Size(fileSize);
TInt maxFileSize = 600000;
if (fileSize > maxFileSize){
- return;
+ User::Leave(KErrTooBig);
}
HBufC8* pFileContent = HBufC8::NewL(fileSize);
@@ -3144,15 +3138,9 @@ void CMTMEngine::updateMMSL(QMessage &message)
RFs fileServer;
User::LeaveIfError(fileServer.Connect());
CleanupClosePushL(fileServer);
- TInt err = file2.Temp(fileServer,iPath,tempFileName,EFileWrite);
- if (err != KErrNone){
- return;
- }
+ User::LeaveIfError(file2.Temp(fileServer,iPath,tempFileName,EFileWrite));
CleanupClosePushL(file2);
- err = file2.Write(*pFileContent);
- if (err != KErrNone){
- return;
- }
+ User::LeaveIfError(file2.Write(*pFileContent));
file2.Close();
User::LeaveIfError(file2.Open(FsSession(),tempFileName, EFileShareAny|EFileRead));
// Mime header
@@ -4352,7 +4340,7 @@ QMessage CMTMEngine::emailMessageL(CMsvEntry& receivedEntry, long int messageId,
}
CleanupStack::PopAndDestroy(pImMimeHeader);
- QByteArray name = QString::fromUtf16(pAttachment->AttachmentName().Ptr(), pAttachment->AttachmentName().Length()).toLocal8Bit();
+ QByteArray name = QString::fromUtf16(pAttachment->AttachmentName().Ptr(), pAttachment->AttachmentName().Length()).toUtf8();
int attachmentSize = pAttachment->Size();
size += attachmentSize;
QMessageContentContainer attachment = QMessageContentContainerPrivate::from(messageId, pAttachment->Id(), name, mimeType, mimeSubType, attachmentSize);
diff --git a/src/serviceframework/ipc/objectendpoint.cpp b/src/serviceframework/ipc/objectendpoint.cpp
index 127257aa5c..199a3b0db9 100644
--- a/src/serviceframework/ipc/objectendpoint.cpp
+++ b/src/serviceframework/ipc/objectendpoint.cpp
@@ -164,7 +164,13 @@ public:
ObjectEndPoint::ObjectEndPoint(Type type, QServiceIpcEndPoint* comm, QObject* parent)
: QObject(parent), dispatch(comm), service(0)
+#ifdef Q_OS_SYMBIAN
+ , referenceCnt(0)
+#endif //End Q_OS_SYMBIAN
{
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "inside ObjectEndPoint::ObjectEndPoint ";
+#endif
Q_ASSERT(dispatch);
d = new ObjectEndPointPrivate;
d->parent = this;
@@ -188,6 +194,9 @@ ObjectEndPoint::~ObjectEndPoint()
void ObjectEndPoint::disconnected()
{
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "Start ObjectEndPoint::disconnected";
+#endif
if (d->endPointType == Service) {
InstanceManager::instance()->removeObjectInstance(d->entry, d->serviceInstanceId);
}
@@ -203,6 +212,9 @@ void ObjectEndPoint::disconnected()
*/
QObject* ObjectEndPoint::constructProxy(const QRemoteServiceRegister::Entry & entry)
{
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "Start ObjectEndPoint::constructProxy";
+#endif
//client side
Q_ASSERT(d->endPointType == ObjectEndPoint::Client);
@@ -239,7 +251,14 @@ QObject* ObjectEndPoint::constructProxy(const QRemoteServiceRegister::Entry & en
void ObjectEndPoint::newPackageReady()
{
//client and service side
-
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "ObjectEndPoint::newPackageReady: Start ..." ;
+#endif
+
+ // The monitor keeps track of this ObjectEndPoint so that it doesn't get deleted while in progress.
+#ifdef Q_OS_SYMBIAN
+ ObjectEndPointMonitor aOem(this);
+#endif //End Q_OS_SYMBIAN
while(dispatch->packageAvailable())
{
QServicePackage p = dispatch->nextPackage();
@@ -260,6 +279,9 @@ void ObjectEndPoint::newPackageReady()
qWarning() << "Unknown package type received.";
}
}
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "ObjectEndPoint::newPackageReady: End" ;
+#endif
}
void ObjectEndPoint::propertyCall(const QServicePackage& p)
@@ -389,6 +411,9 @@ void ObjectEndPoint::objectRequest(const QServicePackage& p)
void ObjectEndPoint::methodCall(const QServicePackage& p)
{
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "ObjectEndPoint::methodCall" ;
+#endif
if (p.d->responseType == QServicePackage::NotAResponse ) {
//service side if slot invocation
//client side if signal emission (isSignal==true)
@@ -616,21 +641,116 @@ QVariant ObjectEndPoint::invokeRemote(int metaIndex, const QVariantList& args, i
void ObjectEndPoint::waitForResponse(const QUuid& requestId)
{
- qDebug() << "start ObjectEndPoint::waitForResponse";
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "start ObjectEndPoint::waitForResponse " ;
+#endif
Q_ASSERT(d->endPointType == ObjectEndPoint::Client);
if (openRequests()->contains(requestId) ) {
Response* response = openRequests()->value(requestId);
QEventLoop* loop = new QEventLoop( this );
- QTimer::singleShot(60000, loop, SLOT(quit()));
+
+ QTimer::singleShot(30000, loop, SLOT(quit()));
connect(this, SIGNAL(pendingRequestFinished()), loop, SLOT(quit()));
loop->exec();
delete loop;
- qDebug() << "- response->isFinished: " << response->isFinished;
}
- qDebug() << "finished ObjectEndPoint::waitForResponse";
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "finished ObjectEndPoint::waitForResponse" ;
+#endif
+}
+
+#ifdef Q_OS_SYMBIAN
+int ObjectEndPoint::getRefCount()
+{
+ return referenceCnt;
+}
+bool ObjectEndPoint::updateRefCount(int expectedVal, int newVal)
+{
+
+ return referenceCnt.testAndSetOrdered(expectedVal, newVal);
}
+
+
+ObjectEndPointMonitor::ObjectEndPointMonitor(ObjectEndPoint *aOe): iOe(aOe), incrementDone(false)
+{
+ if(IncRefCountIfNotMarkedDelete(iOe))
+ incrementDone = true;
+}
+
+ObjectEndPointMonitor::~ObjectEndPointMonitor()
+{
+ if(incrementDone)
+ DecRefCount(iOe);
+}
+
+void ObjectEndPointMonitor::MarkForDelete(ObjectEndPoint *aOe)
+{
+ if(!aOe)
+ return;
+
+
+ while (1) {
+ int oldVal = aOe->getRefCount();
+ //great! Someone already marked it for us..just return
+ if(oldVal >= ObjectEndPoint::MarkedForDelete)
+ return;
+ int newVal = oldVal | ObjectEndPoint::MarkedForDelete;
+ //keep trying if someone beat us to it...
+ if(aOe->updateRefCount(oldVal, newVal)){
+ //there was no other update between the fetching of oldVal and this increment
+ return;
+ }
+ }
+}
+
+bool ObjectEndPointMonitor::IncRefCountIfNotMarkedDelete(ObjectEndPoint *aOe)
+{
+ if(!aOe)
+ return false;
+
+ while (1) {
+ int oldVal = aOe->getRefCount();
+ //fail if someone already marked it for delete
+ if(oldVal >= ObjectEndPoint::MarkedForDelete)
+ return false;
+ //keep trying if someone beat us to it...
+ if(aOe->updateRefCount(oldVal, oldVal+1)){
+ //there was no other update between the fetching of oldVal and this increment
+ return true;
+ }
+ }
+}
+
+void ObjectEndPointMonitor::DecRefCount(ObjectEndPoint *aOe)
+{
+ if(!aOe)
+ return ;
+
+ //while decrementing, we don't care if there it was marked for delete...
+ //we already take care not to increment if it is already marked for delete
+ //the one who destroys has to take care to wait till the reference count is down to zero
+
+ while (1) {
+ int oldVal = aOe->getRefCount();
+ //fail if someone already marked it for delete
+ if(oldVal == ObjectEndPoint::MarkedForDelete)
+ break;
+ //keep trying if someone beat us to it...
+ if(aOe->updateRefCount(oldVal, oldVal-1)){
+ //there was no other update between the fetching of oldVal and this increment
+ break;
+ }
+ }
+
+ if(aOe->getRefCount() == ObjectEndPoint::MarkedForDelete){
+ //This means that it was marked for delete and the ref count is 0
+ QTimer::singleShot(0, aOe, SLOT(deleteLater()));
+ }
+}
+#endif //End Q_OS_SYMBIAN
+
#include "moc_objectendpoint_p.cpp"
QTM_END_NAMESPACE
diff --git a/src/serviceframework/ipc/objectendpoint_p.h b/src/serviceframework/ipc/objectendpoint_p.h
index 9d9245bc50..b911d6501f 100644
--- a/src/serviceframework/ipc/objectendpoint_p.h
+++ b/src/serviceframework/ipc/objectendpoint_p.h
@@ -48,7 +48,9 @@
#include "qservice.h"
#include <QPointer>
#include <QHash>
-
+#ifdef Q_OS_SYMBIAN
+#include <QAtomicInt>
+#endif
QTM_BEGIN_NAMESPACE
class ObjectEndPointPrivate;
@@ -60,7 +62,15 @@ public:
Service = 0,
Client
};
-
+#ifdef Q_OS_SYMBIAN
+ enum DeleteStat {
+ NotMarkedForDelete = 0,
+ MarkedForDelete = 0x8000
+ };
+
+ int getRefCount();
+ bool updateRefCount(int expectedVal, int newVal);
+#endif //End Q_OS_SYMBIAN
ObjectEndPoint(Type type, QServiceIpcEndPoint* comm, QObject* parent = 0);
~ObjectEndPoint();
QObject* constructProxy(const QRemoteServiceRegister::Entry& entry);
@@ -85,8 +95,26 @@ private:
QServiceIpcEndPoint* dispatch;
QPointer<QObject> service;
ObjectEndPointPrivate* d;
+ #ifdef Q_OS_SYMBIAN
+ QAtomicInt referenceCnt;
+ #endif //End Q_OS_SYMBIAN
};
+#ifdef Q_OS_SYMBIAN
+class ObjectEndPointMonitor
+{
+public:
+ ObjectEndPointMonitor(ObjectEndPoint *aOe);
+ ~ObjectEndPointMonitor();
+
+ static void MarkForDelete(ObjectEndPoint *aOe);
+ static bool IncRefCountIfNotMarkedDelete(ObjectEndPoint *aOe);
+ static void DecRefCount(ObjectEndPoint *aOe);
+private:
+ ObjectEndPoint* iOe;
+ bool incrementDone;
+};
+#endif //End Q_OS_SYMBIAN
QTM_END_NAMESPACE
#endif //OBJECT_ENDPOINT_H
diff --git a/src/serviceframework/ipc/proxyobject.cpp b/src/serviceframework/ipc/proxyobject.cpp
index aebc2dcee5..33e5ff5e2d 100644
--- a/src/serviceframework/ipc/proxyobject.cpp
+++ b/src/serviceframework/ipc/proxyobject.cpp
@@ -96,11 +96,19 @@ const QMetaObject* QServiceProxy::metaObject() const
}
int QServiceProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
-{
+{
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "QServiceProxy::qt_metacall: Start";
+#endif
id = QObject::qt_metacall(c, id, a);
if (id < 0 || !d->meta)
return id;
+ //Let the object endpoint monitor keep track of the usage...
+#ifdef Q_OS_SYMBIAN
+ ObjectEndPointMonitor aOem(d->endPoint);
+#endif //End Q_OS_SYMBIAN
+
if(localSignals.at(id)){
QMetaObject::activate(this, d->meta, id, a);
return id;
@@ -215,6 +223,9 @@ int QServiceProxy::qt_metacall(QMetaObject::Call c, int id, void **a)
//TODO
qWarning() << "MetaCall type" << c << "not yet handled";
}
+#ifdef QT_SFW_ENDPOINT_DEBUG
+ qDebug() << "QServiceProxy::qt_metacall: End";
+#endif
return id;
}
diff --git a/src/serviceframework/ipc/qremoteserviceregister_s60.cpp b/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
index 82d2173ab3..56cc472cf8 100644
--- a/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
+++ b/src/serviceframework/ipc/qremoteserviceregister_s60.cpp
@@ -155,10 +155,18 @@ public:
incoming.enqueue(package);
emit readyRead();
}
-
+#ifdef Q_OS_SYMBIAN
+ void resetSession()
+ {
+ session=0;
+ }
+#endif //End Q_OS_SYMBIAN
void setObjectEndPoint(ObjectEndPoint *aObj)
{
obj = aObj;
+#ifdef Q_OS_SYMBIAN
+ session->setObjEndpoint(obj);
+#endif //End Q_OS_SYMBIAN
}
protected:
@@ -168,6 +176,11 @@ protected:
qDebug() << "SymbianServerEndPoint::flushPackage() for package: ";
printServicePackage(package);
#endif
+#ifdef Q_OS_SYMBIAN
+ if(!session)
+ return;
+#endif //End Q_OS_SYMBIAN
+
TRAPD(err, session->SendServicePackageL(package));
if(err != KErrNone){
qDebug() << "flushPackage: Failed to send request: " << err;
@@ -191,6 +204,9 @@ QRemoteServiceRegisterSymbianPrivate::~QRemoteServiceRegisterSymbianPrivate()
void QRemoteServiceRegisterSymbianPrivate::publishServices(const QString &ident)
{
+#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
+ qDebug() << "Start QRemoteServiceRegisterSymbianPrivate::publishServices: " << ident << this;
+#endif
// Create service side of the Symbian Client-Server architecture.
m_server = new CServiceProviderServer(this);
TPtrC serviceIdent(reinterpret_cast<const TUint16*>(ident.utf16()));
@@ -257,7 +273,7 @@ QRemoteServiceRegisterPrivate* QRemoteServiceRegisterPrivate::constructPrivateOb
QObject* QRemoteServiceRegisterPrivate::proxyForService(const QRemoteServiceRegister::Entry &entry, const QString &location)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug() << "proxyForService for location: " << location;
+ qDebug() << " Start QRemoteServiceRegisterPrivate::proxyForService: " << location;
#endif
// Create client-side session for the IPC and connect it to the service
// provide. If service provider is not up, it will be started.
@@ -673,7 +689,7 @@ CPolicyServer::TCustomResult CServiceProviderServer::CustomSecurityCheckL(const
CSession2* CServiceProviderServer::NewSessionL(const TVersion &aVersion, const RMessage2 &aMessage) const
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("CServiceProviderServer::NewSessionL()");
+ qDebug() << "Start CServiceProviderServer::NewSessionL()" ;
#endif
if (!User::QueryVersionSupported(TVersion(KServerMajorVersionNumber,
KServerMinorVersionNumber, KServerBuildVersionNumber), aVersion))
@@ -750,17 +766,35 @@ void CServiceProviderServerSession::ConstructL()
CServiceProviderServerSession::~CServiceProviderServerSession()
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("CServiceProviderServerSession destructor");
+ qDebug() << "CServiceProviderServerSession destructor";
#endif
iServer.DecreaseSessions();
delete iByteArray;
- delete iOwner;
+#ifdef Q_OS_SYMBIAN
+ //Let the pending work get over...
+ ObjectEndPointMonitor::MarkForDelete(iObjEndPoint);
+
+
+ // The session is being deleted. Keep the IPC endpoint up-to-date
+ iOwner->resetSession();
+
+ // Is the ref count of the object endpoint 0? If so, delete the IPC endpoint. Otherwise,
+ // do nothing...the object endpoint will be taken care by the monitor and since the
+ // IPC endpoint is a child of the object endpoint, it shall also be deleted subsequently
+ if( (iObjEndPoint->getRefCount() & ~ObjectEndPoint::MarkedForDelete) == 0){
+ qDebug() << "Delete server IPC endpoint";
+ // Delete the IPC End point only if there is an activity on the Object endpoint
+ delete iOwner;
+ }
+#else
+ delete iOwner;
+#endif//End Q_OS_SYMBIAN
}
void CServiceProviderServerSession::ServiceL(const RMessage2 &aMessage)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug() << "CServiceProviderServerSession::ServiceL for message: " << aMessage.Function();
+ qDebug() << "Start CServiceProviderServerSession::ServiceL for message: " << aMessage.Function() ;
#endif
switch (aMessage.Function())
{
@@ -816,11 +850,17 @@ void CServiceProviderServerSession::SetParent(SymbianServerEndPoint *aOwner)
{
iOwner = aOwner;
}
+#ifdef Q_OS_SYMBIAN
+void CServiceProviderServerSession::setObjEndpoint(ObjectEndPoint* aObjEndpoint)
+{
+ iObjEndPoint = aObjEndpoint;
+}
+#endif //End Q_OS_SYMBIAN
void CServiceProviderServerSession::HandlePackageRequestL(const RMessage2& aMessage)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("HandlePackageRequestL(). Setting pending true and storing message.");
+ qDebug() << "HandlePackageRequestL(). Setting pending true and storing message." ;
#endif
iMsg = aMessage;
iPendingPackageRequest = ETrue;
@@ -831,7 +871,7 @@ void CServiceProviderServerSession::HandlePackageRequestL(const RMessage2& aMess
void CServiceProviderServerSession::HandlePackageRequestCancelL(const RMessage2& aMessage)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("HandlePackageRequestCancelL");
+ qDebug() << "HandlePackageRequestCancelL" ;
#endif
if (iPendingPackageRequest) {
iMsg.Complete(KErrCancel);
@@ -843,7 +883,7 @@ void CServiceProviderServerSession::HandlePackageRequestCancelL(const RMessage2&
void CServiceProviderServerSession::SendServicePackageL(const QServicePackage& aPackage)
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("CServiceProviderServerSession:: SendServicePackage for package: ");
+ qDebug() << "CServiceProviderServerSession:: SendServicePackage for package: ";
printServicePackage(aPackage);
#endif
if (iPendingPackageRequest) {
@@ -907,7 +947,7 @@ ServiceMessageListener::ServiceMessageListener(RServiceSession* aSession, Symbia
ServiceMessageListener::~ServiceMessageListener()
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("ServiceMessageListener destructor");
+ qDebug() << "ServiceMessageListener destructor";
#endif
Cancel();
}
@@ -915,7 +955,7 @@ ServiceMessageListener::~ServiceMessageListener()
void ServiceMessageListener::StartListening()
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("ServiceMessageListener::StartListening");
+ qDebug() << "ServiceMessageListener::StartListening";
#endif
iClientSession->ListenForPackages(iStatus);
SetActive();
@@ -924,7 +964,7 @@ void ServiceMessageListener::StartListening()
void ServiceMessageListener::DoCancel()
{
#ifdef QT_SFW_SYMBIAN_IPC_DEBUG
- qDebug("ServiceMessageListener::DoCancel");
+ qDebug() << "ServiceMessageListener::DoCancel ";
#endif
iClientSession->CancelListenForPackages();
}
diff --git a/src/serviceframework/ipc/qremoteserviceregister_s60_p.h b/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
index 27e1f40376..bd811ec671 100644
--- a/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
+++ b/src/serviceframework/ipc/qremoteserviceregister_s60_p.h
@@ -213,6 +213,9 @@ class CServiceProviderServerSession : public CSession2
void ServiceL(const RMessage2& aMessage);
void SetParent(SymbianServerEndPoint* aOwner);
void SendServicePackageL(const QServicePackage& aPackage);
+ #ifdef Q_OS_SYMBIAN
+ void setObjEndpoint(ObjectEndPoint* aObjEndpoint);
+ #endif
void HandleServicePackageL(const RMessage2& aMessage);
void HandlePackageRequestL(const RMessage2& aMessage);
@@ -231,6 +234,9 @@ class CServiceProviderServerSession : public CSession2
TBool iPendingPackageRequest;
QByteArray iBlockData;
int iTotalSize;
+ #ifdef Q_OS_SYMBIAN
+ ObjectEndPoint* iObjEndPoint;
+ #endif
};
diff --git a/src/serviceframework/serviceframework.pro b/src/serviceframework/serviceframework.pro
index f260a058f2..0eb3720201 100644
--- a/src/serviceframework/serviceframework.pro
+++ b/src/serviceframework/serviceframework.pro
@@ -34,6 +34,7 @@ SOURCES += servicemetadata.cpp \
dberror.cpp \
qremoteserviceregister.cpp
symbian {
+ # DEFINES +=QT_SFW_ENDPOINT_DEBUG
contains(S60_VERSION, 5.2)|contains(MOBILITY_SD_MCL_BUILD, yes){
DEFINES += SYMBIAN_EMULATOR_SUPPORTS_PERPROCESS_WSD
}
diff --git a/src/systeminfo/symbian/telephonyinfo_s60.cpp b/src/systeminfo/symbian/telephonyinfo_s60.cpp
index 942a2db36c..8607bac65a 100644
--- a/src/systeminfo/symbian/telephonyinfo_s60.cpp
+++ b/src/systeminfo/symbian/telephonyinfo_s60.cpp
@@ -919,6 +919,10 @@ void CBatteryInfo::RunL()
}
m_batteryLevel = m_batteryinfo.iChargeLevel;
}
+
+ if (iStatus == KErrPermissionDenied) {
+ return; //No monitoring required
+ }
startMonitoring();
TRACES(qDebug() << "CBatteryInfov2::RunL()--->");
}
@@ -1012,6 +1016,10 @@ void CCellSignalStrengthInfo::RunL()
}
m_prevsignalBar = m_signalBar;
}
+
+ if (iStatus == KErrPermissionDenied) {
+ return; //No monitoring required
+ }
startMonitoring();
TRACES(qDebug() << "CCellSignalStrengthInfov2::RunL()--->");
}
@@ -1087,6 +1095,10 @@ void CCellNetworkRegistrationInfo::RunL()
}
m_previousNetworkStatus = m_networkStatus;
}
+
+ if (iStatus == KErrPermissionDenied) {
+ return; //No monitoring required
+ }
startMonitoring();
TRACES (qDebug() << "CCellNetworkRegistrationInfov2::RunL()--->");
}