QObject: use per-thread storage for qFlagLocation()
authorMarc Mutz <marc.mutz@kdab.com>
Sat, 21 Sep 2013 15:42:33 +0000 (17:42 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 16 Nov 2013 15:55:39 +0000 (16:55 +0100)
commit27b7c8ac2f372232e0add9489086c91753033b20
treedb95f14d2afbf1b6cb09966943e9a7b85e7f0582
parentcecceb0cdd87482124a73ecf537f3445d68be13e
QObject: use per-thread storage for qFlagLocation()

qFlagLocation() uses a global char* array to transport source location
information from the connect() side to the metaobject side. The size
of the array is 2 (two), which just about suffices for a single connect()
statement.

Obviously, if more than one thread makes a (_any_) connection at the same
time, the data is useless and, worse, there's a data race.

The non-reentrancy of qFlagLocations() cannot and need not be fixed,
but use a per-thread flagged_locations array in QThreadData so threads
don't disturb each other.

Task-number: QTBUG-3680

Change-Id: If1797c60751f551694def69afee6fbe295bbe2d2
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
(cherry picked from qtbase/c012ee2940bc087720b4aa0d257540921cf9a139)
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/corelib/kernel/qobject.cpp
src/corelib/thread/qthread_p.h