diff options
-rw-r--r-- | dbaccess/source/core/dataaccess/databasecontext.cxx | 21 | ||||
-rw-r--r-- | dbaccess/source/core/inc/databasecontext.hxx | 3 | ||||
-rw-r--r-- | dbaccess/util/dba.component | 4 |
3 files changed, 3 insertions, 25 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index 01d83bafa7ee..b57cd9be52db 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -54,6 +54,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/weak.hxx> #include <rtl/uri.hxx> #include <sal/log.hxx> #include <svl/filenotation.hxx> @@ -85,10 +86,6 @@ using ::com::sun::star::ucb::InteractiveIOException; using ::com::sun::star::ucb::IOErrorCode_NOT_EXISTING; using ::com::sun::star::ucb::IOErrorCode_NOT_EXISTING_PATH; -static osl::Mutex g_InstanceGuard; -static rtl::Reference<dbaccess::ODatabaseContext> g_Instance; -static bool g_Disposed = false; - namespace dbaccess { @@ -267,14 +264,6 @@ void ODatabaseContext::disposing() } } -void ODatabaseContext::dispose() -{ - DatabaseAccessContext_Base::dispose(); - osl::MutexGuard aGuard(g_InstanceGuard); - g_Instance.clear(); - g_Disposed = true; -} - // XNamingService Reference< XInterface > ODatabaseContext::getRegisteredObject(const OUString& _rName) { @@ -762,13 +751,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* com_sun_star_comp_dba_ODatabaseContext_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& ) { - osl::MutexGuard aGuard(g_InstanceGuard); - if (g_Disposed) - return nullptr; - if (!g_Instance) - g_Instance.set(new dbaccess::ODatabaseContext(context)); - g_Instance->acquire(); - return static_cast<cppu::OWeakObject*>(g_Instance.get()); + return cppu::acquire(static_cast<cppu::OWeakObject*>(new dbaccess::ODatabaseContext(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/inc/databasecontext.hxx b/dbaccess/source/core/inc/databasecontext.hxx index 8cfa0eb2b6df..4f561ebd2401 100644 --- a/dbaccess/source/core/inc/databasecontext.hxx +++ b/dbaccess/source/core/inc/databasecontext.hxx @@ -115,9 +115,6 @@ public: // OComponentHelper virtual void SAL_CALL disposing() override; - // XComponent - virtual void SAL_CALL dispose() override; - // XSingleServiceFactory virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( ) override; virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& _rArguments ) override; diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component index 83795ff82f77..7fcf892bb489 100644 --- a/dbaccess/util/dba.component +++ b/dbaccess/util/dba.component @@ -37,9 +37,7 @@ <service name="com.sun.star.sdb.TableDefinition"/> </implementation> <implementation name="com.sun.star.comp.dba.ODatabaseContext" - constructor="com_sun_star_comp_dba_ODatabaseContext_get_implementation"> - <!-- fake singleton so the servicemanager calls dispose() on us so we can clean up the global --> - <singleton name="com.sun.star.comp.dba.theODatabaseContext"/> + constructor="com_sun_star_comp_dba_ODatabaseContext_get_implementation" single-instance="true"> <service name="com.sun.star.sdb.DatabaseContext"/> </implementation> <implementation name="com.sun.star.comp.dba.ODatabaseDocument" |