Browse Source

prevent deadlock on exit with pstats

David Rose 17 years ago
parent
commit
c740062d29

+ 4 - 0
panda/src/display/graphicsEngine.cxx

@@ -503,6 +503,10 @@ remove_all_windows() {
   // And, hey, let's stop the vertex paging threads, if any.
   VertexDataPage::stop_threads();
 
+#ifdef DO_PSTATS
+  PStatClient::get_global_pstats()->disconnect();
+#endif
+
   // Well, and why not clean up all threads here?
   Thread::prepare_for_exit();
 }

+ 2 - 0
panda/src/net/connectionWriter.cxx

@@ -106,6 +106,8 @@ ConnectionWriter::
     (*ti)->join();
   }
 }
+
+////////////////////////////////////////////////////////////////////
 //     Function: ConnectionWriter::set_max_queue_size
 //       Access: Public
 //  Description: Limits the number of packets that may be pending on

+ 2 - 4
panda/src/pstatclient/pStatClient.cxx

@@ -110,10 +110,6 @@ PStatClient() :
 PStatClient::
 ~PStatClient() {
   disconnect();
-
-  if (has_impl()) {
-    delete _impl;
-  }
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -425,6 +421,8 @@ client_disconnect() {
   ReMutexHolder holder(_lock);
   if (has_impl()) {
     _impl->client_disconnect();
+    delete _impl;
+    _impl = NULL;
   }
 
   ThreadPointer *threads = (ThreadPointer *)_threads;