QWindowSystemInterface: fix mem leak and race
authorMarc Mutz <marc.mutz@kdab.com>
Mon, 6 Aug 2012 14:07:38 +0000 (16:07 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 7 Aug 2012 06:53:42 +0000 (08:53 +0200)
commit39c2fdd9070f81705f1de927694b8589f69da149
tree9798334ca22aed7a367e1328c7fe735213944b4f
parent4ec169a60f9270a9ba673857de90e3b38ac94e7c
QWindowSystemInterface: fix mem leak and race

There was a race where QGuiApplicationPrivate::processMouseEvent accessed
QWindowSystemInterfacePrivate::windowSystemEventQueue without holding
QWindowSystemInterfacePrivate::queueMutex.

There was a memory leak where QWindowSystemInterfacePrivate::windowSystemEventQueue
would not delete events contained in it when it was destroyed.

Fix both of these by properly encapsulating the QList/QMutex pair
in a small class, WindowSystemEventList, that allows only properly protected access
to the internal QList and calls qDeleteAll() in its dtor.

Change-Id: Ifaa9968c9272096df2f7109a7a6cf1c8e5fa736c
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface_p.h