close windows properly
This commit is contained in:
parent
8d36f68f6b
commit
855a365c7f
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue