qt5base-lts/tests/auto/corelib/kernel/qobject
Kari Oikarinen a952fd7d5b QObject: Fix isSignalConnected() when signals have been disconnected
The bitmap cache for the first 64 signals being connected was only set when the
connection is added. It was never unset when the connection was removed.

Internal use of the connectedSignals bitmap is not hurt by it occasionally
saying a signal is connected even though it is not, since the purpose of those
checks is avoiding expensive operations that are not necessary if nothing is
connected to the signal.

However, the public API using this cache meant that it also never spotted
signals being disconnected. This was not documented. Fix the behavior by only
using the cache if it is up to date. If it is not, use a slower path that gives
the correct answer.

To avoid making disconnections and QObject destructions slower, the cache is
only updated to unset disconnected signals when new signal connections are
added. No extra work is done in the common case where signals are only
removed in the end of the QObject's lifetime.

Fixes: QTBUG-32340
Change-Id: Ieb6e498060157153cec60d9c8f1c33056993fda1
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-10-31 10:32:41 +00:00
..
signalbug tst_qobject: Use qt_test_helper functionality 2018-07-31 05:27:01 +00:00
.gitignore tst_qobject: Fix execution in debug&release shadow builds 2018-06-26 10:56:31 +00:00
BLACKLIST Blacklist and skip various tests that are flakey 2015-06-14 10:50:45 +00:00
qobject.pro tst_qobject: Use qt_test_helper functionality 2018-07-31 05:27:01 +00:00
test.pro tst_qobject: Use qt_test_helper functionality 2018-07-31 05:27:01 +00:00
tst_qobject.cpp QObject: Fix isSignalConnected() when signals have been disconnected 2018-10-31 10:32:41 +00:00