Unlike other input devices, touch devices are managed by corresponding
handler threads which are not the main thread. InputEvent that is
inherited by TouchEvent has a constant pointer member for device, but in
touch events case, handler threads may destroy the device which is
pointed by events while processing these events in main thread,
and this may cause critical potential issues such as crash. In order to
prevent this race condition, move device of QEvdevTouchScreenHandler
into main thread and delete this device later if QGuiApplication
instance exists when handler thread quits, and check event's device is
valid when processing touch events.
Change-Id: I02583238d97d768abcc544ee882160eda3178282
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>