summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2015-01-14 14:20:04 +0100
committerMorten Johan Sørvig <morten.sorvig@digia.com>2015-01-16 14:27:26 +0100
commitb2cff0b4bf93bc85b9b76098e8e8ff2fdaf83198 (patch)
treeb05d5fe29bf69936a9076e0243c3f945b15633a5
parent5239ba95e8d68a96b2783793576490f119fb5700 (diff)
Fix stylesheet crash.
Style sheets that refer to the progress bar (like "QProgressDialog[maximum='0']{}") may dereference a null-pointer during the styleHint() call in QProgressDialogPrivate::init() since the progress bar has not been created yet. Move the creation of the progress bar closer to the top of init(), before the styleHint() call. Change-Id: I31c3c1c346430fc9fe86b0977403dea0c0dc5e90 Task-number: QTBUG-43830 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 01ca398a14..371949e768 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -108,10 +108,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
{
Q_Q(QProgressDialog);
label = new QLabel(labelText, q);
- int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
- label->setAlignment(Qt::Alignment(align));
bar = new QProgressBar(q);
bar->setRange(min, max);
+ int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, 0, q);
+ label->setAlignment(Qt::Alignment(align));
autoClose = true;
autoReset = true;
forceHide = false;