From 07339d03afe742c53c22cb4ff5f73fe3132cff54 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 19 Sep 2016 21:18:23 +0200 Subject: Remove obsolete workaround for SUNPRO 5 compiler ...copy/pasted into three more places Change-Id: I6661244d0248af509cd867fc3e8c451551068a78 --- .../source/drivers/firebird/SubComponent.hxx | 25 ++++++++++++---------- include/comphelper/proparrhlp.hxx | 25 +++++++++++----------- mysqlc/source/mysqlc_subcomponent.hxx | 24 +++++++++++---------- .../Database/DriverSkeleton/OSubComponent.hxx | 24 +++++++++++---------- 4 files changed, 53 insertions(+), 45 deletions(-) diff --git a/connectivity/source/drivers/firebird/SubComponent.hxx b/connectivity/source/drivers/firebird/SubComponent.hxx index 7a86cf196864..5c8709717c4c 100644 --- a/connectivity/source/drivers/firebird/SubComponent.hxx +++ b/connectivity/source/drivers/firebird/SubComponent.hxx @@ -68,17 +68,7 @@ namespace connectivity public: OPropertyArrayUsageHelper(); - virtual ~OPropertyArrayUsageHelper() - { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) - // but SUNPRO 5 compiler (linker) doesn't like this - ::osl::MutexGuard aGuard(s_aMutex); - OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); - if (!--s_nRefCount) - { - delete s_pProps; - s_pProps = nullptr; - } - } + virtual ~OPropertyArrayUsageHelper(); /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the class, which is created if necessary. @@ -116,6 +106,19 @@ namespace connectivity } + template + OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + delete s_pProps; + s_pProps = nullptr; + } + } + + template ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper::getArrayHelper() { diff --git a/include/comphelper/proparrhlp.hxx b/include/comphelper/proparrhlp.hxx index 0f8fe7ebc36a..507c51b6618d 100644 --- a/include/comphelper/proparrhlp.hxx +++ b/include/comphelper/proparrhlp.hxx @@ -45,18 +45,7 @@ protected: public: OPropertyArrayUsageHelper(); - virtual ~OPropertyArrayUsageHelper() - { // ARGHHHHHHH ..... would like to implement this after the class - // definition (as we do with all other methods) but SUNPRO 5 compiler - // (linker) doesn't like this - ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex::get()); - OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); - if (!--s_nRefCount) - { - delete s_pProps; - s_pProps = nullptr; - } - } + virtual ~OPropertyArrayUsageHelper(); /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the class, which is created if necessary. @@ -124,6 +113,18 @@ OPropertyArrayUsageHelper::OPropertyArrayUsageHelper() ++s_nRefCount; } +template +OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper() +{ + ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex::get()); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + delete s_pProps; + s_pProps = nullptr; + } +} + template ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper::getArrayHelper() { diff --git a/mysqlc/source/mysqlc_subcomponent.hxx b/mysqlc/source/mysqlc_subcomponent.hxx index 384eeeec923c..404143973831 100644 --- a/mysqlc/source/mysqlc_subcomponent.hxx +++ b/mysqlc/source/mysqlc_subcomponent.hxx @@ -100,17 +100,7 @@ namespace connectivity public: OPropertyArrayUsageHelper(); - virtual ~OPropertyArrayUsageHelper() - { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) - // but SUNPRO 5 compiler (linker) doesn't like this - ::osl::MutexGuard aGuard(s_aMutex); - OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); - if (!--s_nRefCount) - { - delete s_pProps; - s_pProps = nullptr; - } - } + virtual ~OPropertyArrayUsageHelper(); /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the class, which is created if necessary. @@ -146,6 +136,18 @@ namespace connectivity ++s_nRefCount; } + template + OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + delete s_pProps; + s_pProps = nullptr; + } + } + template ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper::getArrayHelper() { diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx index 3aa08f12a1af..3d50a87e19c9 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/OSubComponent.hxx @@ -117,17 +117,7 @@ namespace connectivity public: OPropertyArrayUsageHelper(); - virtual ~OPropertyArrayUsageHelper() - { // ARGHHHHHHH ..... would like to implement this in proparrhlp_impl.hxx (as we do with all other methods) - // but SUNPRO 5 compiler (linker) doesn't like this - ::osl::MutexGuard aGuard(s_aMutex); - OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); - if (!--s_nRefCount) - { - delete s_pProps; - s_pProps = NULL; - } - } + virtual ~OPropertyArrayUsageHelper(); /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the class, which is created if necessary. @@ -163,6 +153,18 @@ namespace connectivity ++s_nRefCount; } + template + OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper() + { + ::osl::MutexGuard aGuard(s_aMutex); + OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !"); + if (!--s_nRefCount) + { + delete s_pProps; + s_pProps = NULL; + } + } + template ::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper::getArrayHelper() { -- cgit