[Libreoffice-commits] core.git: 3 commits - basic/source bridges/source extensions/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 18 07:01:42 UTC 2019
basic/source/basmgr/basicmanagerrepository.cxx | 19 +------------
bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx | 22 ---------------
extensions/source/propctrlr/modulepcr.cxx | 29 ++++++--------------
3 files changed, 12 insertions(+), 58 deletions(-)
New commits:
commit 10f4db67b6690cecfe449b4283b52f56400f07e2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 14:00:18 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 08:00:23 2019 +0100
Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)
Change-Id: Ib0965f57cb929a220fc9df381abdca654985c9de
Reviewed-on: https://gerrit.libreoffice.org/85330
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx
index a7da05f3e947..88b6d4d97152 100644
--- a/extensions/source/propctrlr/modulepcr.cxx
+++ b/extensions/source/propctrlr/modulepcr.cxx
@@ -19,38 +19,27 @@
#include "modulepcr.hxx"
-#include <rtl/instance.hxx>
-#include <osl/getglobalmutex.hxx>
#include <unotools/resmgr.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
namespace pcr
{
- struct CreateModuleClass
- {
- PcrModule* operator()()
- {
- static PcrModule* pModule = new PcrModule;
- return pModule;
- /* yes, in theory, this is a resource leak, since the PcrModule
- will never be cleaned up. However, using a non-heap instance of PcrModule
- would not work: It would be cleaned up when the module is unloaded.
- This might happen (and is likely to happen) *after* the tools-library
- has been unloaded. However, the module's dtor is where we would delete
- our resource manager (in case not all our clients de-registered) - which
- would call into the already-unloaded tools-library. */
- }
- };
-
PcrModule::PcrModule()
{
}
PcrModule& PcrModule::getInstance()
{
- return *rtl_Instance< PcrModule, CreateModuleClass, ::osl::MutexGuard, ::osl::GetGlobalMutex >::
- create( CreateModuleClass(), ::osl::GetGlobalMutex() );
+ static PcrModule* pModule = new PcrModule;
+ return *pModule;
+ /* yes, in theory, this is a resource leak, since the PcrModule
+ will never be cleaned up. However, using a non-heap instance of PcrModule
+ would not work: It would be cleaned up when the module is unloaded.
+ This might happen (and is likely to happen) *after* the tools-library
+ has been unloaded. However, the module's dtor is where we would delete
+ our resource manager (in case not all our clients de-registered) - which
+ would call into the already-unloaded tools-library. */
}
OUString PcrRes(const char* pId)
commit 51e7a590976f664deb0a386d23b66bee38ea5687
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 13:58:20 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 07:59:59 2019 +0100
Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)
Change-Id: Ie3e099a6561c22646f07dab418f1a2f8123f1449
Reviewed-on: https://gerrit.libreoffice.org/85329
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index c493da8bd29d..1e9378ff864b 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -38,8 +38,6 @@
#include <comphelper/documentinfo.hxx>
#include <unotools/eventlisteneradapter.hxx>
-#include <osl/getglobalmutex.hxx>
-#include <rtl/instance.hxx>
#include <sot/storage.hxx>
#include <map>
@@ -198,19 +196,6 @@ namespace basic
StarBASIC* impl_getDefaultAppBasicLibrary();
};
- namespace {
-
- struct CreateImplRepository
- {
- ImplRepository* operator()()
- {
- static ImplRepository repository;
- return &repository;
- }
- };
-
- }
-
ImplRepository::ImplRepository()
{
}
@@ -218,8 +203,8 @@ namespace basic
ImplRepository& ImplRepository::Instance()
{
- return *rtl_Instance< ImplRepository, CreateImplRepository, ::osl::MutexGuard, ::osl::GetGlobalMutex >::
- create( CreateImplRepository(), ::osl::GetGlobalMutex() );
+ static ImplRepository repository;
+ return repository;
}
BasicManager* ImplRepository::getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel )
commit 8473ac2e27efff3ec902a358896a669ce05f047a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 17 13:56:07 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 18 07:59:40 2019 +0100
Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)
which does not seem to have been doing anything useful here anyway, not
since
commit 730399de90add4e35da9754a8f7525b443237026
Date: Wed Jul 18 11:16:06 2007 +0000
INTEGRATION: CWS unomacli64 (1.6.50); FILE MERGED
2007/06/20 10:29:46 kr 1.6.50.1: fixed: #i78284#
Change-Id: I57345a08c333953a66b3a5f3be1fe9a2f1f092ef
Reviewed-on: https://gerrit.libreoffice.org/85328
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
index 422b6893b3a2..466d83ef46a4 100644
--- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
+++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
@@ -23,9 +23,6 @@
#include <vtablefactory.hxx>
#include <com/sun/star/uno/XInterface.hpp>
-#include <osl/getglobalmutex.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
#include <typelib/typedescription.h>
#include <cstddef>
@@ -53,23 +50,6 @@ void dso_exit() {
}
}
-namespace {
-
-struct InitVtableFactory {
- bridges::cpp_uno::shared::VtableFactory * operator()() {
- return pInstance;
- }
-};
-
-bridges::cpp_uno::shared::VtableFactory * getVtableFactory() {
- return rtl_Instance<
- bridges::cpp_uno::shared::VtableFactory, InitVtableFactory,
- osl::MutexGuard, osl::GetGlobalMutex >::create(
- InitVtableFactory(), osl::GetGlobalMutex());
-}
-
-}
-
namespace bridges { namespace cpp_uno { namespace shared {
void freeCppInterfaceProxy(uno_ExtEnvironment * pEnv, void * pInterface)
@@ -101,7 +81,7 @@ com::sun::star::uno::XInterface * CppInterfaceProxy::create(
typelib_typedescription_complete(
reinterpret_cast< typelib_TypeDescription ** >(&pTypeDescr));
const bridges::cpp_uno::shared::VtableFactory::Vtables& rVtables(
- getVtableFactory()->getVtables(pTypeDescr));
+ pInstance->getVtables(pTypeDescr));
std::unique_ptr< char[] > pMemory(
new char[
sizeof (CppInterfaceProxy)
More information about the Libreoffice-commits
mailing list