mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
Unsubscribe SDL input modules from events on exit.
This commit is contained in:
parent
b755be89a6
commit
2b0cc65dba
@ -435,6 +435,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void exit() override
|
||||
{
|
||||
// unsubscribe for events
|
||||
sdl_event_manager::instance().unsubscribe(this);
|
||||
|
||||
input_module_base::exit();
|
||||
}
|
||||
|
||||
void before_poll(running_machine& machine) override
|
||||
{
|
||||
// Tell the event manager to process events and push them to the devices
|
||||
|
@ -96,12 +96,16 @@ public:
|
||||
std::lock_guard<std::mutex> scope_lock(m_lock);
|
||||
|
||||
// Loop over the entries and find ones that match our subscriber
|
||||
// remove those that match
|
||||
for (auto iter = m_subscription_index.begin(); iter != m_subscription_index.end(); iter++)
|
||||
std::vector<typename std::unordered_multimap<int, TSubscriber*>::iterator> remove;
|
||||
for (auto iter = m_subscription_index.begin(); iter != m_subscription_index.end(); ++iter)
|
||||
{
|
||||
if (iter->second == subscriber)
|
||||
m_subscription_index.erase(iter);
|
||||
remove.push_back(iter);
|
||||
}
|
||||
|
||||
// remove those that matched
|
||||
for (int i = 0; i < remove.size(); i++)
|
||||
m_subscription_index.erase(remove[i]);
|
||||
}
|
||||
|
||||
virtual void process_events(running_machine &machine) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user