From: Michael Friedrich Date: Wed, 20 Feb 2019 11:38:57 +0000 (+0100) Subject: Stop object in reversed activation priority order X-Git-Tag: v2.11.0-rc1~212^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a25e2b1038c34d2c11c51a47986c9cf5870021e4;p=icinga2 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 --- 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)