diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-05-22 13:14:11 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-05-22 13:16:26 (GMT) |
commit | 327d94ce8054718d0ce157604594e470e90d6cb4 (patch) | |
tree | 41af96e3ac808d07f10d42597cb86198a778b67b /src/gui/styles/qgtkstyle.cpp | |
parent | 1ee8715fe0dfa784be987cc0cfb4519b2f20adb0 (diff) | |
download | Qt-327d94ce8054718d0ce157604594e470e90d6cb4.zip Qt-327d94ce8054718d0ce157604594e470e90d6cb4.tar.gz Qt-327d94ce8054718d0ce157604594e470e90d6cb4.tar.bz2 |
Fixes a potential crash when changing system palette with QGtkStyle
The problem was that we installed an eventfilter regardless if the
gtk symbols were defined or not. Instead we now initialize and
check for the symbols before we install the filter.
Task-number: 254342
Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index ca71da2..86653df 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -140,10 +140,7 @@ static const char * const dock_widget_restore_xpm[] = class QGtkStyleFilter : public QObject { public: - QGtkStyleFilter() { - qApp->installEventFilter(this); - } - + QGtkStyleFilter() {} private: bool eventFilter(QObject *obj, QEvent *e); }; @@ -167,7 +164,12 @@ class QGtkStylePrivate : public QCleanlooksStylePrivate public: QGtkStylePrivate() : QCleanlooksStylePrivate() - {} + { + QGtk::initGtkWidgets(); + if (QGtk::isThemeAvailable()) + qApp->installEventFilter(&filter); + + } QGtkStyleFilter filter; }; @@ -243,7 +245,6 @@ static QString uniqueName(const QString &key, const QStyleOption *option, const QGtkStyle::QGtkStyle() : QCleanlooksStyle(*new QGtkStylePrivate) { - QGtk::initGtkWidgets(); } /*! |