qt5base-lts/tests/auto
João Abecasis 9a890a519e Add support for setSharable in RefCount
A reference count of 0 (zero) would never change. RefCount::deref to
zero would return false (resource should be freed), subsequent calls on
the same state would return true and not change state. While safe from
RefCount's side, calling deref on a reference count of zero potentially
indicated a dangling reference.

With this change, a reference count of 0 is now abused to imply a
non-sharable instance (cf. QVector::setSharable). This instance is to be
deleted upon deref(), as the data is not shared and has a single owner.

In practice, this means an (intentional) change in behaviour in that
deref'ing zero still won't change state, but will return false, turning
previous access to dangling references into double free errors.

Users of RefCount wanting to support non-sharable instances are required
to check the return of RefCount::ref() and use RefCount::isShared() to
determine whether to detach (instead of directly checking count == 1).

New functions are introduced to determine whether RefCount indicates a
"Static" (permanent, typically read-only) or "Sharable" instance and
whether the instance is currently "Shared" and requires detaching prior
to accepting modifications..

This change formalizes -1 as the value used to flag persistent,
read-only instances, no longer reserving the full negative domain. The
concrete value is part of the ABI, but not of the API. (isStatic and
Q_REFCOUNT_INITIALIZE_STATIC are part of the API, instead)

Change-Id: I9a63c844155319bef0411e02b47f9d92476afefe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2012-01-05 13:59:14 +01:00
..
bic
compilerwarnings/data Remove uilib and QtUiTools from QtBase 2011-09-13 20:11:40 +02:00
corelib Add support for setSharable in RefCount 2012-01-05 13:59:14 +01:00
dbus Fix stack overwrite in QDBusDemarshaller 2011-11-23 19:14:12 +01:00
gui Extend touch events. 2011-12-09 14:15:37 +01:00
guiapplauncher
network Remove QtWidgets dependency from QTcpSocket autotest 2011-12-09 12:25:14 +01:00
opengl Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
other Extend touch events. 2011-12-09 14:15:37 +01:00
sql Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
testlib QTestlib/Selftest: Fix Windows. 2011-12-08 08:51:35 +01:00
tools Revert "Add QObject::objectNameChanged(const QString &objectName) signal" 2011-12-02 06:03:12 +01:00
v8 qtbase tests: Fix some warnings 2011-11-21 09:58:23 +01:00
widgets Extend touch events. 2011-12-09 14:15:37 +01:00
xml Remove TESTED_CLASS/TESTED_FILES comments from tests. 2011-12-06 02:19:25 +01:00
auto.pro Re-enable 'check' target for tests/auto/gui on Mac OS X 2011-12-09 02:39:06 +01:00
network-settings.h Fix sanity check of network test server 2011-11-28 08:13:41 +01:00
platformquirks.h Remove unused PlatformQuirks functions. 2011-11-05 02:31:07 +01:00
test.pl