[Libreoffice-commits] online.git: common/SigUtil.cpp common/SigUtil.hpp wsd/LOOLWSD.cpp
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 9 07:23:45 UTC 2019
common/SigUtil.cpp | 6 +++++-
common/SigUtil.hpp | 6 +++---
wsd/LOOLWSD.cpp | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
New commits:
commit 35646b7bf954c97186a34dfd9ed5ee1e7f3e2fe7
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 9 09:23:17 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 9 09:23:17 2019 +0200
common: wrap DumpGlobalState in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
DumpGlobalState:
==5783==ERROR: AddressSanitizer: odr-violation (0x00000208f7a0):
[1] size=1 'DumpGlobalState' ../common/SigUtil.cpp:49:19
[2] size=1 'DumpGlobalState' common/SigUtil.cpp:49:19
These globals were registered at these points:
[1]:
#0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0x7f5c5edf1c9b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ac9b)
[2]:
#0 0x5f9a08 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
#1 0xe2b98e in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b98e)
Change-Id: I4b7b0238eb9b38a30875e8788c1dcb27f1d1643f
diff --git a/common/SigUtil.cpp b/common/SigUtil.cpp
index c5029a229..49387b38d 100644
--- a/common/SigUtil.cpp
+++ b/common/SigUtil.cpp
@@ -39,14 +39,18 @@
#include "Log.hpp"
static std::atomic<bool> TerminationFlag(false);
+static std::atomic<bool> DumpGlobalState(false);
namespace SigUtil
{
std::atomic<bool>& getTerminationFlag()
{
return TerminationFlag;
}
+ std::atomic<bool>& getDumpGlobalState()
+ {
+ return DumpGlobalState;
+ }
}
-std::atomic<bool> DumpGlobalState(false);
#if MOBILEAPP
std::atomic<bool> MobileTerminationFlag(false);
diff --git a/common/SigUtil.hpp b/common/SigUtil.hpp
index f3d620b92..ea7595ab6 100644
--- a/common/SigUtil.hpp
+++ b/common/SigUtil.hpp
@@ -24,10 +24,10 @@ namespace SigUtil
{
/// Flag to stop pump loops.
std::atomic<bool>& getTerminationFlag();
-}
-/// Flag to dump internal state
-extern std::atomic<bool> DumpGlobalState;
+ /// Flag to dump internal state
+ std::atomic<bool>& getDumpGlobalState();
+}
#if MOBILEAPP
extern std::atomic<bool> MobileTerminationFlag;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index fcf25e9cd..1493399f5 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3141,10 +3141,10 @@ private:
void wakeupHook() override
{
- if (DumpGlobalState)
+ if (SigUtil::getDumpGlobalState())
{
dump_state();
- DumpGlobalState = false;
+ SigUtil::getDumpGlobalState() = false;
}
}
};
More information about the Libreoffice-commits
mailing list