From a25e2b1038c34d2c11c51a47986c9cf5870021e4 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Wed, 20 Feb 2019 12:38:57 +0100 Subject: [PATCH] Stop object in reversed activation priority order This stops the checker component first, then notifications, then features, then config objects, then the API feature and logger(s). Patch taken from @al2klimov --- lib/base/configobject.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index b73285bc5..149917a43 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -617,7 +617,15 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes) void ConfigObject::StopObjects() { - for (const Type::Ptr& type : Type::GetAllTypes()) { + std::vector types = Type::GetAllTypes(); + + std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) { + if (a->GetActivationPriority() > b->GetActivationPriority()) + return true; + return false; + }); + + for (const Type::Ptr& type : types) { auto *dtype = dynamic_cast(type.get()); if (!dtype) -- 2.40.0