Andy Piper wrote:
>> At 08:52 PM 3/10/99 -0500, David Bush wrote:
>> >On repeated exposure events in the Cygwin build I get an assertion
>> >failure in mswindows_dequeue_dispatch_event. I've never looked at
>> >this code before so there is little chance I could resolve the issue
>> >by the deadline for the next beta.
[snip]
Jonathan you know the event code better than me - to me the assertion seems
a little OTT, could we maybe make the failure slightly less brittle and
discard events that we don't think should be there?
My knowledge is a little rusty, but I'm pretty sure that the assert is
good. Just from looking at the code this looks potentially suspect in
mswindows_need_event():
active = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);
if (active == 0)
{
return; /* timeout */
}
and I notice that in the HAVE_MSG_SELECT version of the
mswindows_need_event() code the call to MsgWaitForMultipleObjects() is
lacking the assert that is present in the non-HAVE_MSG_SELECT version:
assert ((!badly_p && active == WAIT_TIMEOUT) ||
(active >= WAIT_OBJECT_0 &&
active <= WAIT_OBJECT_0 + mswindows_waitable_count));
mswindows_need_event(1) is called by emacs_mswindows_next_event() which
_must_ return an event, so mswindows_need_event(1) must not return
without having put an event in one of the two queues. The real question
appears to be: why is mswindows_need_event(1) timing out? I would
suggest that adding asserts after the select() and
MsgWaitForMultipleObjects() calls in the HAVE_MSG_SELECT version of
mswindows_need_event() would help narrow down the problem.
We can maybe mask the problem by doing something like the following, but
I would be uncomfortable not knowing why we have to mask the problem:
static void
emacs_mswindows_next_event (struct Lisp_Event *emacs_event)
{
Lisp_Object event, event2;
while (NILP (mswindows_u_dispatch_event_queue) &&
NILP (mswindows_s_dispatch_event_queue))
mswindows_need_event (1);
event = mswindows_dequeue_dispatch_event (...
Jonathan.
--
Jonathan Harris | jhar(a)tardis.ed.ac.uk
London, England | Jonathan.Harris(a)symbian.com