On 02.12.2010, at 10:07, [email protected] wrote:

> Author: manolo
> Date: 2010-12-02 01:07:31 -0800 (Thu, 02 Dec 2010)
> New Revision: 7937
> Log:
> To fix STR #2464
> 
> Modified:
>   branches/branch-1.3/src/Fl_cocoa.mm
> 
> Modified: branches/branch-1.3/src/Fl_cocoa.mm
> ===================================================================
> --- branches/branch-1.3/src/Fl_cocoa.mm       2010-12-02 00:43:07 UTC (rev 
> 7936)
> +++ branches/branch-1.3/src/Fl_cocoa.mm       2010-12-02 09:07:31 UTC (rev 
> 7937)
> @@ -2494,13 +2494,15 @@
> 
> void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
> {
> -  for (int i = 0; i < mac_timer_used; ++i) {
> -    MacTimeout& t = mac_timers[i];
> -    if (t.callback == cb  && ( t.data == data || data == NULL)) {
> -      delete_timer(t);
> +  if (mac_timer_used) {
> +    for (int i = 0; i < mac_timer_used; ++i) {
> +      MacTimeout& t = mac_timers[i];
> +      if (t.callback == cb  && ( t.data == data || data == NULL)) {
> +     delete_timer(t);
> +      }
>     }
> +    breakMacEventLoop();
>   }
> -  breakMacEventLoop();
> }

But this code is different! It will not clear the first timer if only one timer 
is used! The if-clause should probably go in front to the 
"breackMacEventLoop()", or how about this:


> char found = 0;
> for (int i = 0; i < mac_timer_used; ++i) {
>   MacTimeout& t = mac_timers[i];
>   if (t.callback == cb  && ( t.data == data || data == NULL)) {
>     found = 1;
>     delete_timer(t);
>   }
> }
> if (found)
>   breakMacEventLoop();

Actually, I am not entirely sure that we need to break the EventLoop at all?!

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to