Harden WidgetAttributes debug stream operator
The call site may pass in a null-widget, so guard for that. Pick-to: 6.7 Change-Id: I631cb2fc105bad69faf3daaeac4b893457d27cc1 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
90a94527d2
commit
97c02b80ae
@ -13214,16 +13214,17 @@ QDebug operator<<(QDebug debug, const WidgetAttributes &attributes)
|
||||
{
|
||||
const QDebugStateSaver saver(debug);
|
||||
debug.nospace();
|
||||
const QWidget *widget = attributes.widget;
|
||||
const QMetaObject *qtMo = qt_getEnumMetaObject(Qt::WA_AttributeCount);
|
||||
const QMetaEnum me = qtMo->enumerator(qtMo->indexOfEnumerator("WidgetAttribute"));
|
||||
debug << '[';
|
||||
int count = 0;
|
||||
for (int a = 0; a < Qt::WA_AttributeCount; ++a) {
|
||||
if (widget->testAttribute(static_cast<Qt::WidgetAttribute>(a))) {
|
||||
if (count++)
|
||||
debug << ',';
|
||||
debug << me.valueToKey(a);
|
||||
if (const QWidget *widget = attributes.widget) {
|
||||
const QMetaObject *qtMo = qt_getEnumMetaObject(Qt::WA_AttributeCount);
|
||||
const QMetaEnum me = qtMo->enumerator(qtMo->indexOfEnumerator("WidgetAttribute"));
|
||||
int count = 0;
|
||||
for (int a = 0; a < Qt::WA_AttributeCount; ++a) {
|
||||
if (widget->testAttribute(static_cast<Qt::WidgetAttribute>(a))) {
|
||||
if (count++)
|
||||
debug << ',';
|
||||
debug << me.valueToKey(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
debug << ']';
|
||||
|
Loading…
x
Reference in New Issue
Block a user