diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index cfe8ca55cd..5afcc896a9 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -631,9 +631,12 @@ open_windows() { do_resort_windows(); } - _app.do_windows(this); + // We do it twice, to allow both cull and draw to process the + // window. + for (int i = 0; i < 2; ++i) { + _app.do_windows(this); + _app.do_pending(this); - { PStatTimer timer(_wait_pcollector); Threads::const_iterator ti; for (ti = _threads.begin(); ti != _threads.end(); ++ti) { @@ -648,21 +651,6 @@ open_windows() { thread->_cv_start.signal(); thread->_cv_mutex.release(); } - - // We do it twice, to allow both cull and draw to process the - // window. - for (ti = _threads.begin(); ti != _threads.end(); ++ti) { - RenderThread *thread = (*ti).second; - thread->_cv_mutex.lock(); - - while (thread->_thread_state != TS_wait) { - thread->_cv_done.wait(); - } - - thread->_thread_state = TS_do_windows; - thread->_cv_start.signal(); - thread->_cv_mutex.release(); - } } } diff --git a/panda/src/framework/pandaFramework.cxx b/panda/src/framework/pandaFramework.cxx index a4cc060d0b..9404f3acab 100644 --- a/panda/src/framework/pandaFramework.cxx +++ b/panda/src/framework/pandaFramework.cxx @@ -905,6 +905,9 @@ event_esc(CPT_Event event, void *data) { // Free up the mouse for that window. self->remove_mouse(win); + // Make sure the close request propagates through the system. + self->_engine->open_windows(); + // If we closed the last window, shut down. if (self->all_windows_closed()) { self->_exit_flag = true;