Browse Source

protect from recursive entry

David Rose 22 năm trước cách đây
mục cha
commit
bd3c75357f

+ 6 - 3
panda/src/display/graphicsBuffer.cxx

@@ -111,7 +111,12 @@ set_close_now() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void GraphicsBuffer::
 void GraphicsBuffer::
 process_events() {
 process_events() {
-  switch (_open_request) {
+  // Save the current request and reset it immediately, in case we end
+  // up calling recursively back into this function.
+  OpenRequest this_request = _open_request;
+  _open_request = OR_none;
+
+  switch (this_request) {
   case OR_none:
   case OR_none:
     return;
     return;
 
 
@@ -123,8 +128,6 @@ process_events() {
     close_buffer();
     close_buffer();
     break;
     break;
   }
   }
-
-  _open_request = OR_none;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////