From abae1561038dcd8b6510c6f876b7c9b819134501 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 8 Oct 2009 19:07:37 +0000 Subject: [PATCH] minor fixes --- direct/src/plugin/p3dMainObject.cxx | 4 ++-- direct/src/plugin/p3dWinSplashWindow.cxx | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/direct/src/plugin/p3dMainObject.cxx b/direct/src/plugin/p3dMainObject.cxx index b9e7e82996..545744cad4 100644 --- a/direct/src/plugin/p3dMainObject.cxx +++ b/direct/src/plugin/p3dMainObject.cxx @@ -408,8 +408,8 @@ read_log(const string &log_pathname, P3D_object *params[], int num_params) { } log.read(buffer, size); - P3D_object *result = new P3DStringObject(buffer, size); + P3D_object *result = new P3DStringObject(buffer, log.gcount()); delete[] buffer; - + return result; } diff --git a/direct/src/plugin/p3dWinSplashWindow.cxx b/direct/src/plugin/p3dWinSplashWindow.cxx index 74d50cc6fb..6ee752a839 100755 --- a/direct/src/plugin/p3dWinSplashWindow.cxx +++ b/direct/src/plugin/p3dWinSplashWindow.cxx @@ -302,9 +302,16 @@ stop_thread() { PostThreadMessage(_thread_id, WM_USER, 0, 0); } - if (_thread != NULL){ - WaitForSingleObject(_thread, INFINITE); - + if (_thread != NULL){ + // If the thread doesn't close right away, call PeekMessage() to + // check for Windows messages that the thread might be waiting + // for. + while (WaitForSingleObject(_thread, 200) == WAIT_TIMEOUT) { + MSG msg; + PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE | PM_NOYIELD); + nout << "Waiting for thread\n"; + } + CloseHandle(_thread); _thread = NULL;