mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-20 18:21:12 +00:00
fix #9225 events with negative priority getting erroneously deleted
previously is_map_[id] would point to the wrong event, so that when an event was later deleted by id the wrong event would be deleted.
This commit is contained in:
parent
4927e71ed1
commit
c15df9d3f5
@ -144,7 +144,6 @@ void event_handlers::finish_adding_event_handler(handler_ptr handler)
|
|||||||
// construct weak_ptrs from the shared one.
|
// construct weak_ptrs from the shared one.
|
||||||
DBG_EH << "inserting event handler for name=" << names << " with id=" << id;
|
DBG_EH << "inserting event handler for name=" << names << " with id=" << id;
|
||||||
active_.emplace_back(handler);
|
active_.emplace_back(handler);
|
||||||
std::stable_sort(active_.rbegin(), active_.rend(), cmp);
|
|
||||||
|
|
||||||
// File by name.
|
// File by name.
|
||||||
if(utils::might_contain_variables(names)) {
|
if(utils::might_contain_variables(names)) {
|
||||||
@ -160,6 +159,7 @@ void event_handlers::finish_adding_event_handler(handler_ptr handler)
|
|||||||
id_map_[id] = active_.back();
|
id_map_[id] = active_.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::stable_sort(active_.rbegin(), active_.rend(), cmp);
|
||||||
log_handlers();
|
log_handlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user