From a0a919d2b541c415ad9b81d2ee91895bf106e9bb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 3 Oct 2014 10:39:28 +0200 Subject: remove SvRefBase::QueryDelete Move it's functionality into the only place that needs it, in the dbase driver. Removes an extra virtual call from a widely used class. The dbase driver seems to be using to perform some kind of whacky object recycling, so it's not like we want this functionality to be used somewhere else. Change-Id: I41018f71e0b0a79fdd3d527536f0ac95c788e614 Reviewed-on: https://gerrit.libreoffice.org/11786 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- include/tools/ref.hxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'include/tools/ref.hxx') diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx index b18ce055081c..aecc2b379e00 100644 --- a/include/tools/ref.hxx +++ b/include/tools/ref.hxx @@ -26,6 +26,10 @@ #include #include +/** + This implements similar functionality to boost::intrusive_ptr +*/ + namespace tools { /** T must be a class that extends SvRefBase */ @@ -152,7 +156,6 @@ class TOOLS_DLLPUBLIC SvRefBase protected: virtual ~SvRefBase(); - virtual void QueryDelete(); public: SvRefBase() : bNoDelete(1), nRefCount(0) {} @@ -183,7 +186,13 @@ public: { assert( nRefCount >= 1); if( --nRefCount == 0 && !bNoDelete) - QueryDelete(); + { + // I'm not sure about the original purpose of this line, but right now + // it serves the purpose that anything that attempts to do an AddRef() + // after an object is deleted will trip an assert. + nRefCount = 1 << 30; + delete this; + } } unsigned int GetRefCount() const -- cgit