From 8ad1717055683c573f81181c7749ba422fa96d13 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 6 Feb 2019 11:17:45 +0100 Subject: [PATCH] Respect activation priority also on deactivation --- lib/base/configobject.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 9d44db60a..bf43dd2ba 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -33,6 +33,7 @@ #include "base/workqueue.hpp" #include "base/context.hpp" #include "base/application.hpp" +#include #include #include #include @@ -617,7 +618,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes) void ConfigObject::StopObjects() { - for (const Type::Ptr& type : Type::GetAllTypes()) { + auto types = Type::GetAllTypes(); + + std::sort(types.begin(), types.end(), [](const Type::Ptr& a, const Type::Ptr& b) { + return a->GetActivationPriority() > b->GetActivationPriority(); + }); + + for (const Type::Ptr& type : types) { auto *dtype = dynamic_cast(type.get()); if (!dtype)