Fix evdevtouch input plugin crash when the device can't be opened

If a device fails to open during the plugin startup, we exit the handler
constructor early and leave the d member as nullptr.

However the recently added m_handler->isFiltered() call after m_handler
is instantiated assumes that d is always valid, which triggers a crash
in the forementionned situation. Fix it to check for d's validity first.

This can occur when a device is connected then disconnected right after,
so that it's gone by the time we get the notification from udev.

Change-Id: Ia755868338f92b91c181be8557e06e087d70fcc6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Romain Pokrzywka 2018-06-18 19:01:05 +02:00 committed by Romain Pokrzywka
parent b6421f9dd0
commit d0acd26c37

View File

@ -368,7 +368,7 @@ QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
bool QEvdevTouchScreenHandler::isFiltered() const
{
return d->m_filtered;
return d && d->m_filtered;
}
QTouchDevice *QEvdevTouchScreenHandler::touchDevice() const