Respect activation priority also on deactivation

This commit is contained in:
Alexander A. Klimov 2019-02-06 11:17:45 +01:00
parent 1eaad0637b
commit 8ad1717055
1 changed files with 8 additions and 1 deletions

View File

@ -33,6 +33,7 @@
#include "base/workqueue.hpp" #include "base/workqueue.hpp"
#include "base/context.hpp" #include "base/context.hpp"
#include "base/application.hpp" #include "base/application.hpp"
#include <algorithm>
#include <fstream> #include <fstream>
#include <boost/exception/errinfo_api_function.hpp> #include <boost/exception/errinfo_api_function.hpp>
#include <boost/exception/errinfo_errno.hpp> #include <boost/exception/errinfo_errno.hpp>
@ -617,7 +618,13 @@ void ConfigObject::RestoreObjects(const String& filename, int attributeTypes)
void ConfigObject::StopObjects() 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<ConfigType *>(type.get()); auto *dtype = dynamic_cast<ConfigType *>(type.get());
if (!dtype) if (!dtype)