summaryrefslogtreecommitdiff
path: root/vcl/README.lifecycle
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-03-20 17:24:08 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 13:01:48 +0100
commit8fb4672aef888fc5a582ca9508799ecdbe777c42 (patch)
tree346757e6c1bc9664a53270f868a1762edf094e2d /vcl/README.lifecycle
parentd1091fd50adb1c01d1b1393fd662278611f9e7e1 (diff)
ScopedVclPtr: needs an = operator to make life flow.
Without this, assigning to a ScopedVclPtr instance thus: pScopedVclPtr = new Foo(); constructed a new intermediate ScopedVCLPtr, used a default assignment operator, unhelpfully disposing the new Foo before it could make it to pScopedVclPtr => add operator, and hide problematic constructors. Change-Id: Icc0da962938bf115eac0c24a6a76cfeb66ddf23a
Diffstat (limited to 'vcl/README.lifecycle')
-rw-r--r--vcl/README.lifecycle8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle
index 201e212a9c77..1ee7eab7ea6b 100644
--- a/vcl/README.lifecycle
+++ b/vcl/README.lifecycle
@@ -67,6 +67,14 @@ to lingering pointers to freed objects.
'dispose' methods, in order to provide a minimal initial
behavioral change.
+ As such a VclPtr can have three states:
+
+ VclPtr<PushButton> pButton;
+ ...
+ assert (pButton == nullptr || !pButton); // null
+ assert (pButton && !pButton->IsDisposed()); // alive
+ assert (pButton && pButton->IsDisposed()); // disposed
+
** ScopedVclPtr - making disposes easier
While replacing existing code with new, it can be a bit