summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-23 10:25:26 +0200
committerMichael Meeks <michael.meeks@collabora.com>2015-04-10 13:07:04 +0100
commita6e5ac3be1398aa63fab1d751d6238daeb3a2b2f (patch)
tree416ada012c62f6f28f5836bfc65f35333daa5574
parentcalling delete on VclPtr (diff)
downloadcore-a6e5ac3be1398aa63fab1d751d6238daeb3a2b2f.tar.gz
core-a6e5ac3be1398aa63fab1d751d6238daeb3a2b2f.zip
vclwidget: add some safety net asserts
Change-Id: I5fa19ec6161ab97eb7df8b52a268917f41ae2205
-rw-r--r--include/vcl/outdev.hxx2
-rw-r--r--include/vcl/vclptr.hxx1
2 files changed, 3 insertions, 0 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f5875b7ccea1..4e2341af6711 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -274,11 +274,13 @@ private:
inline void acquire() const
{
+ assert(!mbDisposed);
mnRefCnt++;
}
inline void release() const
{
+ assert(mnRefCnt>0);
if (!--mnRefCnt)
delete const_cast<OutputDevice*>(this);
}
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index 3e0de767dc95..6ab6373eaf70 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -270,6 +270,7 @@ public:
~ScopedVclPtr()
{
VclPtr<reference_type>::disposeAndClear();
+ assert(VclPtr<reference_type>::get() == nullptr); // make sure there are no lingering references
}
private:
// Most likely we don't want this default copy-construtor.