summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-25 12:59:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-27 17:19:26 +0100
commitc95d91ee35ca09379a8a1d415ae77716ddeadaac (patch)
tree370b0ad6832f3aca2ee0e2ef375bb6f953e5d360 /tools
parent2d8f17565ebe867210f5769851d91b2e7b612a8f (diff)
improve subtyping when dealing with tools::WeakReference
tweak the templating to make it easier to declare a WeakReference that points to a subclass for a weak-capable class. Which lets us declare some fields with more specific types, and dump a lot of unnecessary casting. And make WeakBase be inherited from virtually, so we don't end up with weird states where two weak refernces could point to two different parts of the same object. Change-Id: I3213ea27e087038457b0761b5171c7bce96e71f3 Reviewed-on: https://gerrit.libreoffice.org/48650 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/ref/ref.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/source/ref/ref.cxx b/tools/source/ref/ref.cxx
index 283776dd4cc3..dbb2122529e1 100644
--- a/tools/source/ref/ref.cxx
+++ b/tools/source/ref/ref.cxx
@@ -18,9 +18,16 @@
*/
#include <tools/ref.hxx>
+#include <tools/weakbase.hxx>
SvRefBase::~SvRefBase() COVERITY_NOEXCEPT_FALSE
{
}
+tools::WeakBase::~WeakBase()
+{
+ if( mpWeakConnection.is() )
+ mpWeakConnection->mpReference = nullptr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */