Skip to content

Commit

Permalink
Events: ensure the global event context is always available
Browse files Browse the repository at this point in the history
The Boost unit tests have been failing since I removed the GUI2 event context since the
code expects both that A: the topmost context is the global one and B: that you can't
use join() to join the global context. Removing the UI event context meant the test's
fake_display event_context became the only (and global) context, causing an assert.
  • Loading branch information
Vultraz committed Mar 24, 2018
1 parent e317f34 commit 89e0d7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/events.cpp
Expand Up @@ -186,8 +186,8 @@ context::~context()
// a new event context is created when e.g. a modal dialog is opened, and then
// closed when that dialog is closed. Each context contains a list of the handlers
// in that context. The current context is the one on the top of the stack.
// The global context must always be in the first position.
std::deque<context> event_contexts;
// The global context must always be in the first position, so we initialize it here.
std::deque<context> event_contexts(1);

std::vector<pump_monitor*> pump_monitors;

Expand Down
3 changes: 0 additions & 3 deletions src/wesnoth.cpp
Expand Up @@ -1112,9 +1112,6 @@ int main(int argc, char** argv)
sigaction(SIGCHLD, &terminate_handler, nullptr);
#endif

// declare this here so that it will always be at the front of the event queue.
events::event_context global_context;

SDL_StartTextInput();

try {
Expand Down

0 comments on commit 89e0d7e

Please sign in to comment.