diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 8818cf6ab2..676d5ffbe6 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/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(); } diff --git a/panda/src/net/connectionWriter.cxx b/panda/src/net/connectionWriter.cxx index ac6dcf20eb..f7325a0f12 100644 --- a/panda/src/net/connectionWriter.cxx +++ b/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 diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index d6d149193c..8f0a49ccef 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/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;