diff options
author | LeelaPrasannaKumar Chintagunta <leelaprasannakumar.chintagunta@nokia.com> | 2012-04-02 11:35:24 +0530 |
---|---|---|
committer | LeelaPrasannaKumar Chintagunta <leelaprasannakumar.chintagunta@nokia.com> | 2012-04-02 11:35:24 +0530 |
commit | b8b175f4d51b2c4698885a41a5fe98ffab7e25f2 (patch) | |
tree | 241fdc8cb5bf8f063f2d715fc09f0569dbb42b44 /src | |
parent | 388a98b5de3021c75e8bd5a1fed573eb3d4becd2 (diff) |
Fix for Pixi SharePoint DocApp word crash
Diffstat (limited to 'src')
-rw-r--r-- | src/systeminfo/qsystemdeviceinfo.cpp | 26 | ||||
-rw-r--r-- | src/systeminfo/qsysteminfo_s60.cpp | 59 | ||||
-rw-r--r-- | src/systeminfo/qsysteminfo_s60_p.h | 61 | ||||
-rw-r--r-- | src/systeminfo/qsystemnetworkinfo.cpp | 21 | ||||
-rw-r--r-- | src/systeminfo/qsystemstorageinfo.cpp | 12 | ||||
-rw-r--r-- | src/systeminfo/symbian/storagedisknotifier_s60.cpp | 3 | ||||
-rw-r--r-- | src/systeminfo/symbian/storagestatus_s60.cpp | 9 |
7 files changed, 171 insertions, 20 deletions
diff --git a/src/systeminfo/qsystemdeviceinfo.cpp b/src/systeminfo/qsystemdeviceinfo.cpp index 4d5e389b92..801d10a258 100644 --- a/src/systeminfo/qsystemdeviceinfo.cpp +++ b/src/systeminfo/qsystemdeviceinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -44,8 +44,9 @@ #include <QMetaType> QTM_BEGIN_NAMESPACE - +#ifndef Q_OS_SYMBIAN Q_GLOBAL_STATIC(QSystemDeviceInfoPrivate, deviceInfoPrivateSingleton) +#endif #ifdef QT_SIMULATOR QSystemDeviceInfoPrivate *getSystemDeviceInfoPrivate() { return deviceInfoPrivateSingleton(); } @@ -670,7 +671,14 @@ QSystemDeviceInfo::ProfileDetails::~ProfileDetails() */ int QSystemDeviceInfo::ProfileDetails::messageRingtoneVolume() const { +#ifdef Q_OS_SYMBIAN + QSystemDeviceInfoPrivate* deviceInfo = QSystemDeviceInfoPrivate::deviceinfoPrivateInstance(); + int messageRingtoneVolume = deviceInfo->messageRingtoneVolume(); + delete deviceInfo; + return messageRingtoneVolume; +#else return deviceInfoPrivateSingleton()->messageRingtoneVolume(); +#endif } /*! @@ -679,7 +687,14 @@ int QSystemDeviceInfo::ProfileDetails::messageRingtoneVolume() const */ int QSystemDeviceInfo::ProfileDetails::voiceRingtoneVolume() const { +#ifdef Q_OS_SYMBIAN + QSystemDeviceInfoPrivate* deviceInfo = QSystemDeviceInfoPrivate::deviceinfoPrivateInstance(); + int voiceRingtoneVolume = deviceInfo->voiceRingtoneVolume(); + delete deviceInfo; + return voiceRingtoneVolume; +#else return deviceInfoPrivateSingleton()->voiceRingtoneVolume(); +#endif } /*! @@ -688,7 +703,14 @@ int QSystemDeviceInfo::ProfileDetails::voiceRingtoneVolume() const */ bool QSystemDeviceInfo::ProfileDetails::vibrationActive() const { +#ifdef Q_OS_SYMBIAN + QSystemDeviceInfoPrivate* deviceInfo = QSystemDeviceInfoPrivate::deviceinfoPrivateInstance(); + int vibrationActive = deviceInfo->vibrationActive(); + delete deviceInfo; + return vibrationActive; +#else return deviceInfoPrivateSingleton()->vibrationActive(); +#endif } #include "moc_qsystemdeviceinfo.cpp" diff --git a/src/systeminfo/qsysteminfo_s60.cpp b/src/systeminfo/qsysteminfo_s60.cpp index cdf47f207b..464da8f9ac 100644 --- a/src/systeminfo/qsysteminfo_s60.cpp +++ b/src/systeminfo/qsysteminfo_s60.cpp @@ -428,6 +428,11 @@ bool QSystemInfoPrivate::hasFeatureSupported(QSystemInfo::Feature feature) return isFeatureSupported; } +QSystemNetworkInfoPrivate* QSystemNetworkInfoPrivate::networkinfoPrivateInstance() +{ + return new QSystemNetworkInfoPrivate(); +} + QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent) : QObject(parent) { @@ -449,6 +454,7 @@ QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate(QObject *parent) #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED DeviceInfo::instance()->networkInfoListener()->addObserver(this); #endif + DeviceInfo::instance()->incrementRefCount(); TRACES(qDebug() << "QSystemNetworkInfoPrivate::QSystemNetworkInfoPrivate--->"); } @@ -466,6 +472,14 @@ QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate() #ifdef NETWORKHANDLER_SYMBIAN_SUPPORTED DeviceInfo::instance()->networkInfoListener()->removeObserver(this); #endif + DeviceInfo::instance()->decrementRefCount(); + int refcount = DeviceInfo::instance()->getRefCount(); + if (refcount == 0) + { + DeviceInfo *deviceInfo = DeviceInfo::instance(); + delete deviceInfo; + Dll::FreeTls(); + } TRACES(qDebug() << "QSystemNetworkInfoPrivate::~QSystemNetworkInfoPrivate-->"); } @@ -1074,10 +1088,18 @@ QSystemDisplayInfo::BacklightState QSystemDisplayInfoPrivate::backlightStatus(i return backlightState; } +QSystemStorageInfoPrivate* QSystemStorageInfoPrivate::storageinfoPrivateInstance() +{ + return new QSystemStorageInfoPrivate(); +} + QSystemStorageInfoPrivate::QSystemStorageInfoPrivate(QObject *parent) : QObject(parent) { + TRACES (qDebug() << "QSystemStorageInfoPrivate::QSystemStorageInfoPrivate++"); iFs.Connect(); + TInt errorcode = iFs.ShareProtected(); + TRACES ( qDebug() << "Shareproteted error code:" << errorcode ); DeviceInfo::instance()->mmcStorageStatus()->addObserver(this); #ifdef DISKNOTIFY_SUPPORTED @@ -1086,10 +1108,13 @@ QSystemStorageInfoPrivate::QSystemStorageInfoPrivate(QObject *parent) storageNotifier->AddObserver(this); } #endif + DeviceInfo::instance()->incrementRefCount(); + TRACES (qDebug() << "QSystemStorageInfoPrivate::QSystemStorageInfoPrivate--"); } QSystemStorageInfoPrivate::~QSystemStorageInfoPrivate() { + TRACES (qDebug() << "QSystemStorageInfoPrivate::~QSystemStorageInfoPrivate++"); iFs.Close(); DeviceInfo::instance()->mmcStorageStatus()->removeObserver(this); #ifdef DISKNOTIFY_SUPPORTED @@ -1098,6 +1123,15 @@ QSystemStorageInfoPrivate::~QSystemStorageInfoPrivate() storageNotifier->RemoveObserver(this); } #endif + DeviceInfo::instance()->decrementRefCount(); + int refcount = DeviceInfo::instance()->getRefCount(); + if (refcount == 0) + { + DeviceInfo *deviceInfo = DeviceInfo::instance(); + delete deviceInfo; + Dll::FreeTls(); + } + TRACES (qDebug() << "QSystemStorageInfoPrivate::~QSystemStorageInfoPrivate--"); } qlonglong QSystemStorageInfoPrivate::totalDiskSpace(const QString &driveVolume) @@ -1270,6 +1304,11 @@ QSystemStorageInfo::StorageState QSystemStorageInfoPrivate::CheckDiskSpaceThresh return state; } +QSystemDeviceInfoPrivate* QSystemDeviceInfoPrivate::deviceinfoPrivateInstance() +{ + return new QSystemDeviceInfoPrivate(); +} + QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent) : QObject(parent), m_profileEngine(NULL), m_proEngNotifyHandler(NULL), m_bluetoothRepository(NULL), m_bluetoothNotifyHandler(NULL) @@ -1287,6 +1326,7 @@ QSystemDeviceInfoPrivate::QSystemDeviceInfoPrivate(QObject *parent) #endif DeviceInfo::instance()->phoneInfo(); DeviceInfo::instance()->subscriberInfo(); + DeviceInfo::instance()->incrementRefCount(); } QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate() @@ -1311,6 +1351,15 @@ QSystemDeviceInfoPrivate::~QSystemDeviceInfoPrivate() delete m_bluetoothNotifyHandler; delete m_bluetoothRepository; + + DeviceInfo::instance()->decrementRefCount(); + int refcount = DeviceInfo::instance()->getRefCount(); + if (refcount == 0) + { + DeviceInfo *deviceInfo = DeviceInfo::instance(); + delete deviceInfo; + Dll::FreeTls(); + } } void QSystemDeviceInfoPrivate::connectNotify(const char *signal) @@ -1868,6 +1917,7 @@ QSystemBatteryInfoPrivate::QSystemBatteryInfoPrivate(QObject *parent) m_charger = QSystemBatteryInfo::NoCharger; m_previousChagrger = m_charger ; DeviceInfo::instance()->batteryCommonInfo()->AddObserver(this); + DeviceInfo::instance()->incrementRefCount(); } QSystemBatteryInfoPrivate::~QSystemBatteryInfoPrivate() @@ -1878,6 +1928,15 @@ QSystemBatteryInfoPrivate::~QSystemBatteryInfoPrivate() delete(m_batteryHWRM); m_batteryHWRM = NULL; } + + DeviceInfo::instance()->decrementRefCount(); + int refcount = DeviceInfo::instance()->getRefCount(); + if (refcount == 0) + { + DeviceInfo *deviceInfo = DeviceInfo::instance(); + delete deviceInfo; + Dll::FreeTls(); + } } diff --git a/src/systeminfo/qsysteminfo_s60_p.h b/src/systeminfo/qsysteminfo_s60_p.h index 9a1aa99890..8fd058f7d3 100644 --- a/src/systeminfo/qsysteminfo_s60_p.h +++ b/src/systeminfo/qsysteminfo_s60_p.h @@ -130,7 +130,7 @@ class QSystemNetworkInfoPrivate : public QObject, public MTelephonyInfoObserver, Q_OBJECT public: - + static QSystemNetworkInfoPrivate* networkinfoPrivateInstance(); QSystemNetworkInfoPrivate(QObject *parent = 0); virtual ~QSystemNetworkInfoPrivate(); @@ -241,6 +241,7 @@ class QSystemStorageInfoPrivate : public QObject, private: QSystemStorageInfo::StorageState CheckDiskSpaceThresholdLimit(const QString &); public: + static QSystemStorageInfoPrivate* storageinfoPrivateInstance(); QSystemStorageInfoPrivate(QObject *parent = 0); virtual ~QSystemStorageInfoPrivate(); qlonglong totalDiskSpace(const QString &driveVolume); @@ -295,7 +296,7 @@ class QSystemDeviceInfoPrivate : public QObject, Q_OBJECT public: - + static QSystemDeviceInfoPrivate* deviceinfoPrivateInstance(); QSystemDeviceInfoPrivate(QObject *parent = 0); virtual ~QSystemDeviceInfoPrivate(); @@ -435,6 +436,24 @@ public: return static_cast<DeviceInfo *>(Dll::Tls()); } + void incrementRefCount() + { + m_refcount = m_refcount+1; + TRACES( qDebug() << "DeviceInfo RefCount:" << m_refcount); + } + + int getRefCount() + { + TRACES( qDebug() << "Get RefCount:" << m_refcount); + return m_refcount; + } + + void decrementRefCount() + { + m_refcount = m_refcount-1; + TRACES( qDebug() << "Decrement RefCount:" << m_refcount); + } + void initMobilePhonehandleL() { #ifdef ETELMM_SUPPORTED @@ -445,13 +464,19 @@ public: err = m_etelServer.Connect(); if ( err != KErrNone ) { TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err code RTelServer::Connect" << err); + m_etelServer.Close(); User::Leave(err); } //Eumerate legal phone // Get number of phones TInt phones(0); - User::LeaveIfError(m_etelServer.EnumeratePhones(phones)); + err = m_etelServer.EnumeratePhones(phones); + if ( err != KErrNone) { + m_etelServer.Close(); + TRACES (qDebug() << "DeviceInfo:: EnumeratePhones err code" << err); + User::Leave(err); + } // Get phone info of first legal phone. TInt legalPhoneIndex = KErrNotFound; @@ -465,19 +490,27 @@ public: } } } - User::LeaveIfError(legalPhoneIndex); + if ( legalPhoneIndex == KErrNotFound) { + m_etelServer.Close(); + TRACES (qDebug() << "DeviceInfo:: legalPhoneIndex err code" << legalPhoneIndex); + User::Leave(legalPhoneIndex); + } err = m_rmobilePhone.Open(m_etelServer,m_etelphoneInfo.iName); if (err != KErrNone) { TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err code RMobilePhone::Open =" << err); + m_rmobilePhone.Close(); + m_etelServer.Close(); User::Leave(err); } err = m_rmobilePhone.Initialise(); if (err != KErrNone) { TRACES (qDebug() << "DeviceInfo:: InitMobilePhonehandle err val for RMobilePhone::Initialise =" << err); + m_rmobilePhone.Close(); + m_etelServer.Close(); User::Leave(err); - } + } TRACES (qDebug() << "InitMobilePhonehandleL- successful"); m_rmobilePhoneInitialised = true; @@ -488,10 +521,7 @@ public: { #ifdef ETELMM_SUPPORTED TRAPD ( err,initMobilePhonehandleL()); - if (err ) { - m_rmobilePhone.Close(); - m_etelServer.Close(); - } + if ( err != KErrNone) m_rmobilePhoneInitialised = false; #endif } @@ -689,6 +719,7 @@ public: ,m_networkinfolistener(NULL) #endif ,m_rmobilePhoneInitialised(false) + ,m_refcount(0) { TRACES(qDebug() << "DeviceInfo():Constructor"); m_telephony = CTelephony::NewL(); @@ -696,7 +727,7 @@ public: ~DeviceInfo() { - TRACES(qDebug() << "DeviceInfo():Destructor"); + TRACES(qDebug() << "DeviceInfo():Destructor++"); delete m_cellSignalStrengthInfo; delete m_cellNetworkRegistrationInfo; delete m_cellNetworkInfo; @@ -726,9 +757,14 @@ public: #endif #ifdef ETELMM_SUPPORTED - m_etelServer.Close(); - m_rmobilePhone.Close(); + if ( m_rmobilePhoneInitialised) { + TRACES ( qDebug() << "Closing RMobilePhone handles++"); + m_rmobilePhone.Close(); + m_etelServer.Close(); + TRACES ( qDebug() << "Closing RMobilePhone handles--"); + } #endif + TRACES(qDebug() << "DeviceInfo():Destructor--"); } private: @@ -768,6 +804,7 @@ private: RTelServer::TPhoneInfo m_etelphoneInfo; #endif bool m_rmobilePhoneInitialised; + int m_refcount; }; class QSystemBatteryInfoPrivate : public QObject, public MBatteryInfoObserver, public MBatteryHWRMObserver diff --git a/src/systeminfo/qsystemnetworkinfo.cpp b/src/systeminfo/qsystemnetworkinfo.cpp index 7c3448cce0..14f2ed61c1 100644 --- a/src/systeminfo/qsystemnetworkinfo.cpp +++ b/src/systeminfo/qsystemnetworkinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -44,7 +44,9 @@ #include <QMetaType> QTM_BEGIN_NAMESPACE +#ifndef Q_OS_SYMBIAN Q_GLOBAL_STATIC(QSystemNetworkInfoPrivate, netInfoPrivateSingleton) +#endif #ifdef QT_SIMULATOR QSystemNetworkInfoPrivate *getSystemNetworkInfoPrivate() { return netInfoPrivateSingleton(); } @@ -205,11 +207,21 @@ QSystemNetworkInfo::NetworkStatus QSystemNetworkInfo::networkStatus(QSystemNetwo */ int QSystemNetworkInfo::networkSignalStrength(QSystemNetworkInfo::NetworkMode mode) { +#ifdef Q_OS_SYMBIAN + QSystemNetworkInfoPrivate* networkInfo = QSystemNetworkInfoPrivate::networkinfoPrivateInstance(); + QSystemNetworkInfo::NetworkStatus info = networkInfo->networkStatus(mode); + if (info == QSystemNetworkInfo::UndefinedStatus || info == QSystemNetworkInfo::NoNetworkAvailable) + return -1; + int signalStrength = networkInfo->networkSignalStrength(mode); + delete networkInfo; + return signalStrength; +#else QSystemNetworkInfo::NetworkStatus info = netInfoPrivateSingleton()->networkStatus(mode); if (info == QSystemNetworkInfo::UndefinedStatus || info == QSystemNetworkInfo::NoNetworkAvailable) return -1; return netInfoPrivateSingleton()->networkSignalStrength(mode); +#endif } /*! @@ -296,7 +308,14 @@ QString QSystemNetworkInfo::homeMobileNetworkCode() */ QString QSystemNetworkInfo::networkName(QSystemNetworkInfo::NetworkMode mode) { +#ifdef Q_OS_SYMBIAN + QSystemNetworkInfoPrivate* networkInfo = QSystemNetworkInfoPrivate::networkinfoPrivateInstance(); + QString networkName = networkInfo->networkName(mode); + delete networkInfo; + return networkName; +#else return netInfoPrivateSingleton()->networkName(mode); +#endif } /*! diff --git a/src/systeminfo/qsystemstorageinfo.cpp b/src/systeminfo/qsystemstorageinfo.cpp index 143629df63..5eb67fc3fb 100644 --- a/src/systeminfo/qsystemstorageinfo.cpp +++ b/src/systeminfo/qsystemstorageinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2009-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -44,8 +44,9 @@ #include <QMetaType> QTM_BEGIN_NAMESPACE - +#ifndef Q_OS_SYMBIAN Q_GLOBAL_STATIC(QSystemStorageInfoPrivate, storageInfoPrivateSingleton) +#endif #ifdef QT_SIMULATOR QSystemStorageInfoPrivate *getSystemStorageInfoPrivate() { return storageInfoPrivateSingleton(); } @@ -233,7 +234,14 @@ qlonglong QSystemStorageInfo::availableDiskSpace(const QString &drive) */ QStringList QSystemStorageInfo::logicalDrives() { +#ifdef Q_OS_SYMBIAN + QSystemStorageInfoPrivate* storageInfo = QSystemStorageInfoPrivate::storageinfoPrivateInstance(); + QStringList drivelist = storageInfo->logicalDrives(); + delete storageInfo; + return drivelist; +#else return storageInfoPrivateSingleton()->logicalDrives(); +#endif } /*! diff --git a/src/systeminfo/symbian/storagedisknotifier_s60.cpp b/src/systeminfo/symbian/storagedisknotifier_s60.cpp index 24e9a623d0..06ca04e213 100644 --- a/src/systeminfo/symbian/storagedisknotifier_s60.cpp +++ b/src/systeminfo/symbian/storagedisknotifier_s60.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -56,6 +56,7 @@ CStorageDiskNotifier* CStorageDiskNotifier::NewL() void CStorageDiskNotifier::ConstructL() { User::LeaveIfError(iFs.Connect()); + User::LeaveIfError(iFs.ShareProtected()); iStorageDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, iFs ); SubscribeStorageDiskNotificationL(); } diff --git a/src/systeminfo/symbian/storagestatus_s60.cpp b/src/systeminfo/symbian/storagestatus_s60.cpp index 96526fc4e5..1ada686c31 100644 --- a/src/systeminfo/symbian/storagestatus_s60.cpp +++ b/src/systeminfo/symbian/storagestatus_s60.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010-2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -46,24 +46,29 @@ #include <driveinfo.h> #endif //SYMBIAN_3_1 #include <f32file.h> +#include "trace.h" CMMCStorageStatus::CMMCStorageStatus() : CActive(EPriorityStandard), m_previousDriveList(TDriveList()) { +TRACES ( qDebug() << "CMMCStorageStatus::CMMCStorageStatus++"); CActiveScheduler::Add(this); - if (iFs.Connect() == KErrNone) { + if (iFs.Connect() == KErrNone && iFs.ShareProtected() == KErrNone) { #ifndef SYMBIAN_3_1 m_previousDriveList.Copy(PopulateDriveList()); #endif //SYMBIAN_3_1 startMonitoring(); } +TRACES ( qDebug() << "CMMCStorageStatus::CMMCStorageStatus--"); } CMMCStorageStatus::~CMMCStorageStatus() { +TRACES ( qDebug() << "CMMCStorageStatus::~CMMCStorageStatus++"); Cancel(); iFs.Close(); +TRACES ( qDebug() << "CMMCStorageStatus::~CMMCStorageStatus--"); } void CMMCStorageStatus::addObserver(MStorageStatusObserver *observer) |