83e70c3157
It's good to use a pre-allocated set of points that never changes,
because queryPointById() returns a pointer to the stored instance.
If the flatmap's values are in a QList, and a mouse event comes in at
the wrong time while touchpoints are already stored there, causing
the QList to be resized, the returned pointer can become garbage.
The pointer returned from queryPointById() is never retained for long,
but in practice it turned out this could still happen, at least on X11
(perhaps because of X11 synthesizing mouse events from touch).
Using a pre-allocated QVarLengthFlatMap is also an optimization: events
on single-user systems are unlikely to ever cause memory allocation in
this part of the code.
Many touchscreens support up to 10 touchpoints, but the user might
have some other input devices, plus the "core pointer" (mouse).
The user could also have two touchscreens and try to use them
simultaneously.
|
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |