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>
This commit is contained in:
parent
5239ba95e8
commit
b2cff0b4bf
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user