diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-05-08 11:34:22 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-05-08 12:24:06 +0100 |
commit | b6bd432a584c1361ca6277794f8a5466fc01bc52 (patch) | |
tree | acdefe95a478ead327b8f7e1830a14a22bd54c8c | |
parent | 087f7fe50b03307e2d9202365886e8c37bd7e6e3 (diff) |
vcl: more VclPtr debugging docs in the README.lifecycle.
Change-Id: I49d06d54157e1e7c5b7ce2aa3f8917763de6826d
-rw-r--r-- | vcl/README.lifecycle | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vcl/README.lifecycle b/vcl/README.lifecycle index 7c2ceb218797..55ec1606ea84 100644 --- a/vcl/README.lifecycle +++ b/vcl/README.lifecycle @@ -299,4 +299,28 @@ ways and often both. cleanup methods, especially LoseFocus continue to work even on disposed Window sub-class instances. +** It crashes with some invalid memory ... + + Assuming that the invalid memory is a Window sub-class itself, + then almost certainly there is some cockup in the + reference-counting; eg. if you hit an OutputDevice::release + assert on mnRefCount - then almost certainly you have a + Window that has already been destroyed. This can easily + happen via this sort of pattern: + + ModelessDialog *pDlg = VclPtr<ModelessDialog>(nullptr /* parent */); + // by here the pDlg quite probably points to free'd memory + ... + + It is necessary in these cases to ensure that the *pDlg is + a VclPtr<ModelessDialog> instead. + +** It crashes with some invalid memory #2 ... + + Often a ::dispose method will free some pImpl member, but + not NULL it; and (cf. above) we can now get various virtual + methods called post-dispose; so: + + a) delete pImpl; pImpl = NULL; // in the destructor + b) if (pImpl && ...) // in the subsequently called method |