Qnx: Check if QCoreApplication::instance() exists before using QSocketNotifier
authormfekari <mfekari@gmail.com>
Wed, 28 Nov 2012 09:55:54 +0000 (04:55 -0500)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 28 Nov 2012 15:21:57 +0000 (16:21 +0100)
Change-Id: I9f00314ea1ef73b87bc56ca1f8fcf859c9cd1824
Reviewed-by: Bernd Weimer <bweimer@rim.com>
Reviewed-by: Peter Hartmann <phartmann@rim.com>
src/corelib/tools/qlocale_unix.cpp

index b2aaec7..088e40b 100644 (file)
@@ -49,6 +49,7 @@
 
 #if defined(Q_OS_BLACKBERRY)
 #include <QtCore/private/qcore_unix_p.h>
+#include <QCoreApplication>
 
 #include <unistd.h>
 #include <errno.h>
@@ -114,9 +115,11 @@ void QQNXLocaleData::readPPSLocale()
         return;
     }
 
-    ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this);
     updateMeasurementSystem();
-    QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMeasurementSystem()));
+    if (QCoreApplication::instance()) {
+        ppsNotifier = new QSocketNotifier(ppsFd, QSocketNotifier::Read, this);
+        QObject::connect(ppsNotifier, SIGNAL(activated(int)), this, SLOT(updateMeasurementSystem()));
+    }
 }
 #endif