summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-04-30 08:11:43 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-04-30 08:18:22 (GMT)
commit2c6fdd89086977708850043a075b2b880bd22c9e (patch)
tree227c023704c8c2ce28e7d8fc72522f5306094845 /src/gui
parent073b7ce298b0e079f310ec22dee44a9fc0af9ee6 (diff)
downloadQt-2c6fdd89086977708850043a075b2b880bd22c9e.zip
Qt-2c6fdd89086977708850043a075b2b880bd22c9e.tar.gz
Qt-2c6fdd89086977708850043a075b2b880bd22c9e.tar.bz2
QApplication::setStyle() can cause a crash
QApplication::setStyle() caused a crash if called before constructing the QApplication instance for custom styles. The reason was that polish tried to create a pixmap (which is not allowed before qApp is running). This fix checks that qApp exists. Polish will anyway be called again when qApp gets constructed. Task-number: 243697 Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/styles/qmacstyle_mac.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 398e11d..c973b41 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -2146,8 +2146,11 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint
/*! \reimp */
void QMacStyle::polish(QPalette &pal)
{
- if (qt_mac_backgroundPattern == 0)
+ if (!qt_mac_backgroundPattern) {
+ if (!qApp)
+ return;
qt_mac_backgroundPattern = new QPixmap(d->generateBackgroundPattern());
+ }
QColor pc(Qt::black);
pc = qcolorForTheme(kThemeBrushDialogBackgroundActive);