From d0acd26c37c7b98612308e47e635b792949d7210 Mon Sep 17 00:00:00 2001 From: Romain Pokrzywka Date: Mon, 18 Jun 2018 19:01:05 +0200 Subject: 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 --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/platformsupport') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 7b7649bc5c..f3cc160b3e 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -368,7 +368,7 @@ QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler() bool QEvdevTouchScreenHandler::isFiltered() const { - return d->m_filtered; + return d && d->m_filtered; } QTouchDevice *QEvdevTouchScreenHandler::touchDevice() const -- cgit v1.2.3