Module: check_mk
Branch: master
Commit: c7da38c4188418c6dc53703d03d8e09c88b3ec3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c7da38c4188418…
Author: Sergey Kipnis <sk(a)mathias-kettner.de>
Date: Fri Mar 22 13:49:18 2019 +0100
[CMK-1791] - crash on init globals fixed
- order of init is a problem when you have constructors which requires config data
- this is serious design flaw and to be fixed in the future
Change-Id: Ibbfcbc466c3acb58b07d56bf1c32ae5c4d888289
---
agents/wnx/src/engine/cfg.cpp | 9 +++++++++
agents/wnx/src/engine/groups.cpp | 8 --------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/agents/wnx/src/engine/cfg.cpp b/agents/wnx/src/engine/cfg.cpp
index 2aedb0d..ed3415b 100644
--- a/agents/wnx/src/engine/cfg.cpp
+++ b/agents/wnx/src/engine/cfg.cpp
@@ -56,12 +56,21 @@ std::wstring WinPerf::buildCmdLine() const {
return cmd_line;
}
+// we have chaos with globals
namespace details {
ConfigInfo G_ConfigInfo;
// store boot fixed data
uint64_t RegisteredPerformanceFreq = wtools::QueryPerformanceFreq();
} // namespace details
+// stores EVERYTHING which can be configured
+namespace groups {
+Global global;
+WinPerf winperf;
+Plugins plugins;
+Plugins localGroup;
+}; // namespace groups
+
// API
uint64_t GetPerformanceFrequency() noexcept {
diff --git a/agents/wnx/src/engine/groups.cpp b/agents/wnx/src/engine/groups.cpp
index 9835a7e..fcd6026 100644
--- a/agents/wnx/src/engine/groups.cpp
+++ b/agents/wnx/src/engine/groups.cpp
@@ -22,14 +22,6 @@
namespace cma::cfg {
-// stores EVERYTHING which can be configured
-namespace groups {
-Global global;
-WinPerf winperf;
-Plugins plugins;
-Plugins localGroup;
-}; // namespace groups
-
Global::Global() {
setDefaults();
calcDerivatives();