From 3b81a23326a2af4d630d6695387fcab75500b60a Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 2 Sep 2004 22:34:35 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4145 --- checkin_notes | 9 +++++++++ client/app.C | 15 ++++++++++++--- client/app_control.C | 10 ++++++++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/checkin_notes b/checkin_notes index c943abeffc..dc3c73a59c 100755 --- a/checkin_notes +++ b/checkin_notes @@ -16902,3 +16902,12 @@ David 2 Sept 2004 sched/ sched_shmem.h + +Rom 2 Sep 2004 + - BUGFIX: The active task destructor also tried to clean up dangling handles, so + after cleaning up a handle lets also set the handle value to NULL to keep it from + being acted on again. + + client/ + app.C + app_control.C diff --git a/client/app.C b/client/app.C index e5e8e8e353..7ddae4a462 100644 --- a/client/app.C +++ b/client/app.C @@ -111,9 +111,18 @@ ACTIVE_TASK::ACTIVE_TASK() { ACTIVE_TASK::~ACTIVE_TASK() { #ifdef _WIN32 - if (pid_handle) CloseHandle(pid_handle); - if (thread_handle) CloseHandle(thread_handle); - if (quitRequestEvent) CloseHandle(quitRequestEvent); + if (pid_handle) { + CloseHandle(pid_handle); + pid_handle = NULL; + } + if (thread_handle) { + CloseHandle(thread_handle); + thread_handle = NULL; + } + if (quitRequestEvent) { + CloseHandle(quitRequestEvent); + quitRequestEvent = NULL; + } // detach from shared mem. // This will destroy shmem seg since we're the last attachment // diff --git a/client/app_control.C b/client/app_control.C index 528a0f8202..0b1215ffd9 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -213,8 +213,14 @@ bool ACTIVE_TASK::handle_exited_app(unsigned long exit_code) { if (pending_suspend_via_quit) { pending_suspend_via_quit = false; state = PROCESS_UNINITIALIZED; - CloseHandle(pid_handle); - CloseHandle(thread_handle); + if (pid_handle) { + CloseHandle(pid_handle); + pid_handle = NULL; + } + if (thread_handle) { + CloseHandle(thread_handle); + thread_handle = NULL; + } return true; } if (!finish_file_present()) {