Events: ensure the global event context is always available

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.
This commit is contained in:
Charles Dang 2018-03-25 03:34:34 +11:00
parent e317f346e8
commit 89e0d7e2ae
2 changed files with 2 additions and 5 deletions

View file

@ -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;

View file

@ -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 {