diff --git a/api/graphics_api.C b/api/graphics_api.C index 3eb9112cf8..a4cb77dedf 100755 --- a/api/graphics_api.C +++ b/api/graphics_api.C @@ -52,6 +52,11 @@ int boinc_init_graphics(void (*worker)()) { } int boinc_init_options_graphics(BOINC_OPTIONS& opt, void (*worker)()) { + int retval; + if (!diagnostics_is_initialized()) { + retval = boinc_init_diagnostics(BOINC_DIAG_USEDEFULATS); + if (retval) return retval; + } init_main_state(); return boinc_init_options_graphics_impl(opt, worker, &boinc_main_state); } diff --git a/checkin_notes b/checkin_notes index 6140cc9a1e..c126c61bdd 100755 --- a/checkin_notes +++ b/checkin_notes @@ -4816,4 +4816,21 @@ Rom 16 May 2006 client/win/ hostinfo_win.cpp - \ No newline at end of file + +Rom 16 May 2006 + - Bug Fix: When an application is running in standalone mode the missing + init file should not cause the diagnostics_init() routine to return + an error. + - Bug Fix: Prevent the exception handling thread from stalling when the + foreground window happens to be from its own process space. If you + were single stepping inside of a debugger then the process acted as + though it was deadlocked since the debugger had suspended the other + threads. + - Bug Fix: Initialize the diagnostics library even thuogh an alternate + entrypoint might have been used. + + api/ + graphics_api.C + lib/ + diagnostics.C + diagnostics_win.C diff --git a/lib/diagnostics.C b/lib/diagnostics.C index 44ef3fb332..1c9815d2ea 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -249,20 +249,21 @@ int diagnostics_init( proxy_port = 0; p = fopen(INIT_DATA_FILE, "r"); - if (!p) return ERR_FOPEN; - mf.init_file(p); - while(mf.fgets(buf, sizeof(buf))) { - if (match_tag(buf, "")) break; - else if (parse_str(buf, "", boinc_dir, 256)) continue; - else if (parse_str(buf, "", symstore, 256)) continue; - else if (match_tag(buf, "")) { - boinc_proxy_enabled = true; - continue; - } - else if (parse_str(buf, "", proxy_address, 256)) continue; - else if (parse_int(buf, "", proxy_port)) continue; - } - fclose(p); + if (p) { + mf.init_file(p); + while(mf.fgets(buf, sizeof(buf))) { + if (match_tag(buf, "")) break; + else if (parse_str(buf, "", boinc_dir, 256)) continue; + else if (parse_str(buf, "", symstore, 256)) continue; + else if (match_tag(buf, "")) { + boinc_proxy_enabled = true; + continue; + } + else if (parse_str(buf, "", proxy_address, 256)) continue; + else if (parse_int(buf, "", proxy_port)) continue; + } + fclose(p); + } if (boinc_proxy_enabled) { int buffer_used = snprintf(boinc_proxy, sizeof(boinc_proxy), "%s:%d", proxy_address, proxy_port); diff --git a/lib/diagnostics_win.C b/lib/diagnostics_win.C index 4d2322fae0..d140a9276a 100644 --- a/lib/diagnostics_win.C +++ b/lib/diagnostics_win.C @@ -1220,23 +1220,32 @@ int diagnostics_capture_foreground_window(PBOINC_WINDOWCAPTURE window_info) { window_info->hwnd = GetForegroundWindow(); - GetWindowText( - window_info->hwnd, - window_info->window_name, - sizeof(window_info->window_name) - ); - - GetClassName( - window_info->hwnd, - window_info->window_class, - sizeof(window_info->window_class) - ); - window_info->window_thread_id = GetWindowThreadProcessId( window_info->hwnd, &window_info->window_process_id ); + // Only query the window text from windows in a different process space. + // All threads that might have windows are suspended in this process + // space and attempting to get the window text will deadlock the exception + // handler. + if (window_info->window_process_id != GetCurrentProcessId()) { + GetWindowText( + window_info->hwnd, + window_info->window_name, + sizeof(window_info->window_name) + ); + + GetClassName( + window_info->hwnd, + window_info->window_class, + sizeof(window_info->window_class) + ); + } else { + strcpy(window_info->window_name, ""); + strcpy(window_info->window_class, ""); + } + return 0; }