summaryrefslogtreecommitdiffstats
path: root/bridges
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-12-18 10:30:41 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-12-18 13:02:20 +0100
commit60274d430881ffe8681a2920b4df589d16942ace (patch)
treeb5cb0d314bc3a9cd46dafe8f4313a7426ccff638 /bridges
parentsal_Char->char in avmedia..basic (diff)
downloadcore-60274d430881ffe8681a2920b4df589d16942ace.tar.gz
core-60274d430881ffe8681a2920b4df589d16942ace.zip
Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics),
...redux, after 8473ac2e27efff3ec902a358896a669ce05f047a "Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)" had done the same in parallel but forgot to remove some now-unnecessary parts: There appears to be no good reason to control the lifecycle of the VtableFactory instance via dso_init/exit, instead of via a plain static local variable. This removes the need for the Windows DllMain functions. They also called DisableThreadLibraryCalls, which disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the respective DllMain. Lets assume that this was only done (as an optimization) because there had to be a user-provided DllMain, and that it was not in itself a reason to have a user-provided DllMain. (Most other DllMain across the code base that call DisableThreadLibraryCalls also do something else. The only DllMain that only calls DisableThreadLibraryCalls is the one in shell/source/win32/shlxthandler/ooofilt/ooofilt.cxx, introduced with 3fbfb21e298ba506c50733d4aaefc7550bca2fe4 "INTEGRATION: CWS desktintgr02".) Change-Id: I696e1c8d49060853c1a2c24f67469f6adfea6801 Reviewed-on: https://gerrit.libreoffice.org/85367 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/Library_cpp_uno.mk4
-rw-r--r--bridges/inc/cppinterfaceproxy.hxx5
-rw-r--r--bridges/source/cpp_uno/msvc_win32_intel/dllinit.cxx49
-rw-r--r--bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx44
-rw-r--r--bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx24
5 files changed, 4 insertions, 122 deletions
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index 277c54cf79dc..adb404244319 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -79,7 +79,7 @@ bridge_exception_objects := cpp2uno except uno2cpp
bridge_noncallexception_objects := callvirtualmethod
else ifeq ($(COM),MSC)
bridges_SELECTED_BRIDGE := msvc_win32_intel
-bridge_exception_objects := cpp2uno dllinit uno2cpp
+bridge_exception_objects := cpp2uno uno2cpp
bridge_noopt_objects := except
endif
@@ -174,7 +174,7 @@ bridge_exception_objects := abi call cpp2uno except uno2cpp
bridge_noncallexception_noopt_objects := callvirtualmethod
else ifeq ($(COM),MSC)
bridges_SELECTED_BRIDGE := msvc_win32_x86-64
-bridge_exception_objects := cpp2uno dllinit uno2cpp
+bridge_exception_objects := cpp2uno uno2cpp
bridge_noopt_objects := except
bridge_asm_objects := call
endif
diff --git a/bridges/inc/cppinterfaceproxy.hxx b/bridges/inc/cppinterfaceproxy.hxx
index 4755ea90bced..7d5ab7b167b2 100644
--- a/bridges/inc/cppinterfaceproxy.hxx
+++ b/bridges/inc/cppinterfaceproxy.hxx
@@ -36,11 +36,6 @@ namespace com { namespace sun { namespace star { namespace uno {
class XInterface;
} } } }
-#if !defined __GNUG__
-void dso_init();
-void dso_exit();
-#endif
-
namespace bridges { namespace cpp_uno { namespace shared {
class Bridge;
diff --git a/bridges/source/cpp_uno/msvc_win32_intel/dllinit.cxx b/bridges/source/cpp_uno/msvc_win32_intel/dllinit.cxx
deleted file mode 100644
index f65ef74ba4e5..000000000000
--- a/bridges/source/cpp_uno/msvc_win32_intel/dllinit.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#if !defined WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-
-
-void dso_init();
-void dso_exit();
-
-
-extern "C" BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
-{
- switch(dwReason) {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hModule);
-
- dso_init();
- break;
-
- case DLL_PROCESS_DETACH:
- if (!lpvReserved)
- dso_exit();
- break;
- }
-
- return TRUE;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx
deleted file mode 100644
index 8517f0c72674..000000000000
--- a/bridges/source/cpp_uno/msvc_win32_x86-64/dllinit.cxx
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include <cppinterfaceproxy.hxx>
-
-extern "C" BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
-{
- switch(dwReason) {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hModule);
-
- dso_init();
- break;
-
- case DLL_PROCESS_DETACH:
- if (!lpvReserved)
- dso_exit();
- break;
- }
-
- return TRUE;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
index 466d83ef46a4..29b035fec3ab 100644
--- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
+++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx
@@ -29,27 +29,6 @@
#include <memory>
#include <new>
-
-static bridges::cpp_uno::shared::VtableFactory * pInstance;
-
-#if defined(__GNUG__)
-extern "C" void dso_init() __attribute__((constructor));
-extern "C" void dso_exit() __attribute__((destructor));
-#endif
-
-void dso_init() {
- if (!pInstance)
- pInstance = new bridges::cpp_uno::shared::VtableFactory();
-}
-
-void dso_exit() {
- if (pInstance)
- {
- delete pInstance;
- pInstance = nullptr;
- }
-}
-
namespace bridges { namespace cpp_uno { namespace shared {
void freeCppInterfaceProxy(uno_ExtEnvironment * pEnv, void * pInterface)
@@ -80,8 +59,9 @@ com::sun::star::uno::XInterface * CppInterfaceProxy::create(
{
typelib_typedescription_complete(
reinterpret_cast< typelib_TypeDescription ** >(&pTypeDescr));
+ static bridges::cpp_uno::shared::VtableFactory factory;
const bridges::cpp_uno::shared::VtableFactory::Vtables& rVtables(
- pInstance->getVtables(pTypeDescr));
+ factory.getVtables(pTypeDescr));
std::unique_ptr< char[] > pMemory(
new char[
sizeof (CppInterfaceProxy)