summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qstylehints.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-02-23 17:01:24 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-02-25 14:16:44 +0000
commit33403f2c79d678afc5b76add2c517d99b9708c32 (patch)
tree796fb3e1607a14b9e9e7f00a2e35a326ec083ba6 /src/gui/kernel/qstylehints.cpp
parent7bbde34ee012bbe90c4ce76736c6f71b16e64215 (diff)
Fix crash when accessing QStyleHints before QGuiApplication is constructed.
Make styleHints a static member variable of QGuiApplicationPrivate and fix accessor accordingly. Extend tst_QApplication::settableStyleHints() to run without QApplication instance as well and add a similar test to QGuiApplication. Task-number: QTBUG-44499 Change-Id: I42b92ef38f7dd512d08d70accfa7dd4f09a22f01 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel/qstylehints.cpp')
-rw-r--r--src/gui/kernel/qstylehints.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index a0f98383ff..b7af2e759f 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -35,6 +35,7 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformtheme.h>
#include <private/qguiapplication_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -46,6 +47,10 @@ static inline QVariant hint(QPlatformIntegration::StyleHint h)
static inline QVariant themeableHint(QPlatformTheme::ThemeHint th,
QPlatformIntegration::StyleHint ih)
{
+ if (!QCoreApplication::instance()) {
+ qWarning() << "Must construct a QGuiApplication before accessing a platform theme hint.";
+ return QVariant();
+ }
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
const QVariant themeHint = theme->themeHint(th);
if (themeHint.isValid())