From: Tom Yu Date: Fri, 28 Sep 2007 23:37:09 +0000 (+0000) Subject: pull up r19857 from trunk X-Git-Tag: krb5-1.6.3-beta2~73 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebd4e576facc4ba20e2ff6ac8a3d816a33982c0d;p=krb5.git pull up r19857 from trunk r19857@cathode-dark-space: jaltman | 2007-08-24 10:33:09 -0400 ticket: new subject: NIM: Cannot cancel timers which have inserted a WM_TIMER message into the queue component: windows The credentials view in Network Identity Manager displays several user interface elements that need to be updated periodically such as any fields that denote the time remaining for a credential or an identity, or an icon and coloring used to indicate the expiration state. When the display rows are computed, the credentials view creates a set of timers that reference each row that times out when that row needs to be redrawn. Since the rows change when switching views or when the outline is recomputed, all the timers are canceled and re-scheduled. However, a race conditions exists where the timer times-out before it is canceled, in which case a WM_TIMER message is placed in the credential window's message queue. Windows does not support canceling a timer that has already fired and has been placed on the message queue. By the time the WM_TIMER message is received by the window, the rows of the display would have been recomputed and the row that the message references may not be what it intended to reference. A spurious WM_TIMER message is harmless when it refers to a row corresponding to a credential. However, the existing code assumed that if a timer event is received that referred to an outline row, then that outline must be an expanded view of an identity, which is currently the only type of outline row that receives timers. This assumption does not always hold in the case of a spurious WM_TIMER message and may lead to the code attempting to use the outline data as a handle to an identity. The patch fixes the problem by checking if the row is actually an expanded view of an identity and ignoring the message if it is not. ticket: 5678 version_fixed: 1.6.3 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19992 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c index 62c69668c..0d3f17fe5 100644 --- a/src/windows/identity/ui/credwnd.c +++ b/src/windows/identity/ui/credwnd.c @@ -1239,11 +1239,21 @@ cw_timer_proc(HWND hwnd, FILETIME ft_now; o = (khui_credwnd_outline *) r->data; -#ifdef DEBUG - assert(r->flags & KHUI_CW_ROW_EXPVIEW); - assert(o->attr_id == KCDB_ATTR_ID); - assert(tbl->flags & KHUI_CW_TBL_EXPIDENT); -#endif + + /* we only handle timers for header rows if : + + 1. The table is displaying expanded identity information + 2. The row displaying an expanded view + 3. The relevant outline object is for an identity + + If these conditions aren't met, it is because we lost a + race killing this timer while switching modes. + */ + if (!(tbl->flags & KHUI_CW_TBL_EXPIDENT) || + !(r->flags & KHUI_CW_ROW_EXPVIEW) || + !(o->attr_id == KCDB_ATTR_ID)) + + return; nflags = cw_get_buf_exp_flags(tbl, (khm_handle) o->data); if ((o->flags & CW_EXPSTATE_MASK) != nflags) {