Browse Source

close windows properly

David Rose 20 years ago
parent
commit
855a365c7f
2 changed files with 8 additions and 17 deletions
  1. 5 17
      panda/src/display/graphicsEngine.cxx
  2. 3 0
      panda/src/framework/pandaFramework.cxx

+ 5 - 17
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();
-    }
   }
 }
 

+ 3 - 0
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;