Merge pull request #709 from jyrkive/fix-event-context-crash
Fix undefined behavior on destroying an event context
This commit is contained in:
commit
b9b97bab84
1 changed files with 9 additions and 9 deletions
|
@ -132,15 +132,15 @@ void context::set_focus(const sdl_handler* ptr)
|
|||
|
||||
context::~context()
|
||||
{
|
||||
if (!handlers.empty()) {
|
||||
for (handler_list::iterator it = handlers.begin(); it != handlers.end(); ++it) {
|
||||
if ((*it)->has_joined()) {
|
||||
(*it)->has_joined_ = false;
|
||||
}
|
||||
if ((*it)->has_joined_global()) {
|
||||
(*it)->has_joined_global_ = false;
|
||||
}
|
||||
it = handlers.erase(it);
|
||||
for (sdl_handler* h : handlers)
|
||||
{
|
||||
if (h->has_joined())
|
||||
{
|
||||
h->has_joined_ = false;
|
||||
}
|
||||
if (h->has_joined_global())
|
||||
{
|
||||
h->has_joined_global_ = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue