Widgets: check if parent exists before calling parent->locale()
If a top level, parentless widget has Qt::WA_WindowPropagation set, Qt will crash when trying to resolve the widgets locale. The reason is that we try to access the QLocale of the non-existing parent. This patch will add a check if a parent exists before trying to access it. Task-number: QTBUG-61213 Change-Id: I09a6351a12dc1fffab3069b70e3d7b3932317c85 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
3841a7dd49
commit
0857db89bf
|
|
@ -6007,9 +6007,9 @@ void QWidgetPrivate::resolveLocale()
|
|||
Q_Q(const QWidget);
|
||||
|
||||
if (!q->testAttribute(Qt::WA_SetLocale)) {
|
||||
setLocale_helper(q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)
|
||||
? QLocale()
|
||||
: q->parentWidget()->locale());
|
||||
QWidget *parent = q->parentWidget();
|
||||
setLocale_helper(!parent || (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation))
|
||||
? QLocale() : parent->locale());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue