mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-12 03:21:23 +00:00
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
@ -132,15 +132,15 @@ void context::set_focus(const sdl_handler* ptr)
|
|||||||
|
|
||||||
context::~context()
|
context::~context()
|
||||||
{
|
{
|
||||||
if (!handlers.empty()) {
|
for (sdl_handler* h : handlers)
|
||||||
for (handler_list::iterator it = handlers.begin(); it != handlers.end(); ++it) {
|
{
|
||||||
if ((*it)->has_joined()) {
|
if (h->has_joined())
|
||||||
(*it)->has_joined_ = false;
|
{
|
||||||
}
|
h->has_joined_ = false;
|
||||||
if ((*it)->has_joined_global()) {
|
}
|
||||||
(*it)->has_joined_global_ = false;
|
if (h->has_joined_global())
|
||||||
}
|
{
|
||||||
it = handlers.erase(it);
|
h->has_joined_global_ = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user