summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHurewitz Kevin <kevin.hurewitz@nokia.com>2010-08-02 13:00:00 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-02 13:00:49 (GMT)
commit4778af08ca848c82526305c66dc23bb6b732b944 (patch)
treedb31af398df7868fc5c4105807c31e7a47582b1e /src
parentf127fadc833f7b64977877879787d96586d0a501 (diff)
downloadQt-4778af08ca848c82526305c66dc23bb6b732b944.zip
Qt-4778af08ca848c82526305c66dc23bb6b732b944.tar.gz
Qt-4778af08ca848c82526305c66dc23bb6b732b944.tar.bz2
QDesktopServices crashes when accessing the NULL X11 variable
It appears that QDesktopServices for X11 assumes that it will be used with a GUI application and may access the X11 variable. The X11 variable will be NULL if it has not been initialized by the QApplication initialization. Merge-request: 2442 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/util/qdesktopservices_x11.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/util/qdesktopservices_x11.cpp b/src/gui/util/qdesktopservices_x11.cpp
index fe7f9a6..75e7209 100644
--- a/src/gui/util/qdesktopservices_x11.cpp
+++ b/src/gui/util/qdesktopservices_x11.cpp
@@ -71,10 +71,12 @@ static bool openDocument(const QUrl &url)
if (launch(url, QLatin1String("xdg-open")))
return true;
- if (X11->desktopEnvironment == DE_GNOME && launch(url, QLatin1String("gnome-open"))) {
+ // Use the X11->desktopEnvironment value if X11 is non-NULL,
+ // otherwise just attempt to launch command regardless of the desktop environment
+ if ((!X11 || (X11 && X11->desktopEnvironment == DE_GNOME)) && launch(url, QLatin1String("gnome-open"))) {
return true;
} else {
- if (X11->desktopEnvironment == DE_KDE && launch(url, QLatin1String("kfmclient exec")))
+ if ((!X11 || (X11 && X11->desktopEnvironment == DE_KDE)) && launch(url, QLatin1String("kfmclient exec")))
return true;
}
@@ -104,10 +106,12 @@ static bool launchWebBrowser(const QUrl &url)
if (launch(url, QString::fromLocal8Bit(getenv("BROWSER"))))
return true;
- if (X11->desktopEnvironment == DE_GNOME && launch(url, QLatin1String("gnome-open"))) {
+ // Use the X11->desktopEnvironment value if X11 is non-NULL,
+ // otherwise just attempt to launch command regardless of the desktop environment
+ if ((!X11 || (X11 && X11->desktopEnvironment == DE_GNOME)) && launch(url, QLatin1String("gnome-open"))) {
return true;
} else {
- if (X11->desktopEnvironment == DE_KDE && launch(url, QLatin1String("kfmclient openURL")))
+ if ((!X11 || (X11 && X11->desktopEnvironment == DE_KDE)) && launch(url, QLatin1String("kfmclient openURL")))
return true;
}