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)