Move nullptr check to beginning of QInputDevice::operator<<
Nullptr check was performed after aquisition of the d-pointer. That acquisition crashes if nullptr is passed to the operator, so the actual check was never hit. This patch moves the nullptr check to the beginning of the method. Fixes: QTBUG-112174 Pick-to: 6.5 6.2 5.15 Change-Id: If339e2de9ce2e33e10d925e79ca06b3854a24f76 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
d7f795626d
commit
f5c55da04b
@ -360,19 +360,24 @@ bool QInputDevice::operator==(const QInputDevice &other) const
|
|||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
QDebug operator<<(QDebug debug, const QInputDevice *device)
|
QDebug operator<<(QDebug debug, const QInputDevice *device)
|
||||||
{
|
{
|
||||||
const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
|
|
||||||
if (d->pointingDeviceType)
|
|
||||||
return operator<<(debug, static_cast<const QPointingDevice *>(device));
|
|
||||||
QDebugStateSaver saver(debug);
|
QDebugStateSaver saver(debug);
|
||||||
debug.nospace();
|
debug.nospace();
|
||||||
debug.noquote();
|
debug.noquote();
|
||||||
|
|
||||||
debug << "QInputDevice(";
|
debug << "QInputDevice(";
|
||||||
if (device) {
|
if (!device) {
|
||||||
debug << '"' << device->name() << "\", type=" << device->type()
|
debug << "0)";
|
||||||
<< Qt::hex << ", ID=" << device->systemId() << ", seat='" << device->seatName() << "'";
|
return debug;
|
||||||
} else {
|
|
||||||
debug << '0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QInputDevicePrivate *d = QInputDevicePrivate::get(device);
|
||||||
|
|
||||||
|
if (d->pointingDeviceType)
|
||||||
|
return operator<<(debug, static_cast<const QPointingDevice *>(device));
|
||||||
|
|
||||||
|
debug << "QInputDevice(";
|
||||||
|
debug << '"' << device->name() << "\", type=" << device->type()
|
||||||
|
<< Qt::hex << ", ID=" << device->systemId() << ", seat='" << device->seatName() << "'";
|
||||||
debug << ')';
|
debug << ')';
|
||||||
return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user