From: Fabian Keil Date: Sun, 27 May 2012 15:36:15 +0000 (+0000) Subject: In OnLogCommand(), leverage TIMER_ANIMSTOP_ID to set the idle icon through the 'appli... X-Git-Tag: v_3_0_20~334 X-Git-Url: http://www.privoxy.org/gitweb/show-status?a=commitdiff_plain;h=6c163ce8cb66f1fd352c87766a36892e3e4d1703;p=privoxy.git In OnLogCommand(), leverage TIMER_ANIMSTOP_ID to set the idle icon through the 'application queue' Apparently the functions called by SetIdleIcon() aren't thread-safe and their interaction can cause deadlocks. An earlier version of the patch has been tested by Lee and doesn't seem to cause obvious regressions other than the icon change being delayed by (at least) the 10 milliseconds until the timer fires. This is expected to fix #3525694 reported by Tim H. --- diff --git a/w32log.c b/w32log.c index 3ca29e46..7372136f 100644 --- a/w32log.c +++ b/w32log.c @@ -1,4 +1,4 @@ -const char w32log_rcs[] = "$Id: w32log.c,v 1.44 2012/05/24 14:59:59 fabiankeil Exp $"; +const char w32log_rcs[] = "$Id: w32log.c,v 1.45 2012/05/24 15:05:17 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/w32log.c,v $ @@ -948,7 +948,13 @@ void OnLogCommand(int nCommand) global_toggle_state = !global_toggle_state; log_error(LOG_LEVEL_INFO, "Now toggled %s", global_toggle_state ? "ON" : "OFF"); - SetIdleIcon(); + /* + * Overload TIMER_ANIMSTOP_ID to set the idle icon through the + * "application queue". According to MSDN, 10 milliseconds are + * the lowest value possible and seem to be close enough to + * "instantly". + */ + SetTimer(g_hwndLogFrame, TIMER_ANIMSTOP_ID, 10, NULL); break; #endif /* def FEATURE_TOGGLE */