[comp.windows.x] Bug/misfeature in Xt Toolkit

net@TUB.BITNET (Oliver Laumann) (12/13/88)

Xt automatically removes interval timers and work-procs when the timer
expires or the work-proc returns true, respectively.  If this has
happened, it is not allowed to try to remove the timer or work-proc by
a call to XtRemoveTimeOut or XtRemoveWorkProc, because the ID returned
by the corresponding call to XtAppAdd<Something> is no longer valid
(the memory to which it points has been freed).

This fact is not mentioned in the manual.  It is also undesirable,
because it may be impossible or hard to find out whether the ID of
a timer or work-proc is still valid or not.

I would fix this as follows:  Rename XtRemoveTimeOut into
XtAppRemoveTimeOut (and XtRemoveWorkProc into XtAppRemoveWorkProc,
accordingly).  The application context must then be given as an
argument explicity; now the TimerEventRec* or WorkProcRec* need only
be dereferenced in the XtAppRemove<Something> function if the ID is valid
(that is, has been found in the timer or work-proc queue of the
application context).

Regards,
--
Oliver Laumann              net@TUB.BITNET              net@tub.UUCP