mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-27 01:45:35 -05:00
always place new listeners at the front of the queue
This commit is contained in:
parent
0460fef4a2
commit
69ddb75bd9
1 changed files with 3 additions and 2 deletions
|
@ -9,7 +9,8 @@ bool DefaultEventListenerPool::add(EventListenerProtocol* listener) {
|
|||
m_toAdd.push_back(listener);
|
||||
}
|
||||
else {
|
||||
m_listeners.push_back(listener);
|
||||
// insert listeners at the start so new listeners get priority
|
||||
m_listeners.insert(m_listeners.begin(), listener);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ void DefaultEventListenerPool::handle(Event* event) {
|
|||
if (m_locked == 0) {
|
||||
ranges::remove(m_listeners, nullptr);
|
||||
for (auto listener : m_toAdd) {
|
||||
m_listeners.push_back(listener);
|
||||
m_listeners.insert(m_listeners.begin(), listener);
|
||||
}
|
||||
m_toAdd.clear();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue