summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Pokrzywka <romain.pokrzywka@gmail.com>2017-08-07 12:12:31 -0500
committerRomain Pokrzywka <romain.pokrzywka@gmail.com>2017-08-14 19:02:23 +0000
commitc161c6db780b308a604875c3e0f7affb09e89fce (patch)
tree8e246ae69438051e8e31b66cd405962e9f723814
parent9193b6cc8505244a9f1af9706032f8c62142f75a (diff)
Fix a race condition in QEvdevTabletHandler::readData()
Statics and threads don't mix well. There can be multiple threads calling QEvdevTabletHandler::readData() simultaneously if you have several tablet devices registered with the plugin, creating a race on the static buffer array. Make the buffer a simple local variable instead, the array is small enough that we can afford the per-thread stack allocation. Change-Id: I4487add8df50743b8178ca6faeb9be45231ccb78 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
index 86f8a00b13..cfc17a79c3 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler.cpp
@@ -246,7 +246,7 @@ bool QEvdevTabletHandler::queryLimits()
void QEvdevTabletHandler::readData()
{
- static input_event buffer[32];
+ input_event buffer[32];
int n = 0;
for (; ;) {
int result = QT_READ(m_fd, reinterpret_cast<char*>(buffer) + n, sizeof(buffer) - n);