Fix qmlscene segfault on startup on Mac OS 10.6.
authorMorten Johan Sørvig <morten.sorvig@nokia.com>
Thu, 2 Feb 2012 10:02:01 +0000 (11:02 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 2 Feb 2012 11:49:19 +0000 (12:49 +0100)
Task-number: QTBUG-23982

The platform plugin loader was searching for plugins
in qtbase/bin and would segfault when checking if
the qmlscene binary was a plugin.

Test if "../Plugins" actually exists before setting
it as the platform plugin path.

Change-Id: Ibd887b5c5045d23e3eb62867dc7598e09d3918ad
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/gui/kernel/qguiapplication.cpp

index 4096628..b1cbb5f 100644 (file)
@@ -54,6 +54,7 @@
 #include <QtCore/private/qabstracteventdispatcher_p.h>
 #include <QtCore/qmutex.h>
 #include <QtCore/private/qthread_p.h>
+#include <QtCore/qdir.h>
 #include <QtDebug>
 #include <qpalette.h>
 #include <qscreen.h>
@@ -384,8 +385,9 @@ void QGuiApplicationPrivate::createPlatformIntegration()
     // TODO (msorvig): Create proper cross-platform solution for loading
     // deployed platform plugins
 #ifdef Q_OS_MAC
-    if (platformPluginPath.isEmpty()) {
-        platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+    const QString bundlePluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+    if (platformPluginPath.isEmpty() && QDir(bundlePluginPath).exists()) {
+        platformPluginPath = bundlePluginPath;
     }
 #endif