Browse Source

clean up shutdown

David Rose 23 years ago
parent
commit
9ac12dbe92

+ 15 - 0
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -86,8 +86,10 @@ make_gsg() {
 void wglGraphicsWindow::
 void wglGraphicsWindow::
 release_gsg() {
 release_gsg() {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
   if (_gsg != (GraphicsStateGuardian *)NULL) {
+    wglMakeCurrent(_hdc, _context);
     GraphicsWindow::release_gsg();
     GraphicsWindow::release_gsg();
     wglDeleteContext(_context);
     wglDeleteContext(_context);
+    wglMakeCurrent(_hdc, NULL);
     _context = (HGLRC)0;
     _context = (HGLRC)0;
   }
   }
 }
 }
@@ -180,6 +182,19 @@ open_window() {
   return true;
   return true;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: wglGraphicsWindow::close_window
+//       Access: Protected, Virtual
+//  Description: Closes the window right now.  Called from the window
+//               thread.
+////////////////////////////////////////////////////////////////////
+void wglGraphicsWindow::
+close_window() {
+  ReleaseDC(_mwindow, _hdc);
+  _hdc = (HDC)0;
+  WinGraphicsWindow::close_window();
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: wglGraphicsWindow::choose_pfnum
 //     Function: wglGraphicsWindow::choose_pfnum
 //       Access: Private
 //       Access: Private

+ 1 - 0
panda/src/wgldisplay/wglGraphicsWindow.h

@@ -40,6 +40,7 @@ public:
 
 
 protected:
 protected:
   virtual bool open_window();
   virtual bool open_window();
+  virtual void close_window();
 
 
 private:
 private:
   int choose_pfnum() const;
   int choose_pfnum() const;