STR #3188

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.3 ]

STR #3188

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:3 - Moderate, e.g. unable to compile the software
Scope:2 - Specific to an operating system
Subsystem:Core Library
Summary:Callback added using Fl::add_timeout is not called (X11)
Version:1.3.3
Created By:meixner
Assigned To:AlbrechtS
Fix Version:1.3.6
Fix Commit:770663920e00d9e3922f5e0cf93960a43e4c2657
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size top right image
 
#1 AlbrechtS
04:27 Sep 02, 2016
check_timer_after_flush.patch
1k
 
 
#2 AlbrechtS
07:50 Sep 02, 2016
str-3188_add_timeout.cxx
1k
 
bottom left image   bottom right image

Trouble Report Comments:


Name/Time/Date Text top right image
 
#1 meixner
05:20 Feb 16, 2015
If a callback is added using Fl::add_timeout from within Fl_Widget::draw it is not called in time. Reason is the following code in Fl.cxx:570


    // do flush first so that user sees the display:
    flush();
    if (idle && !in_idle) // 'idle' may have been set within flush()
      time_to_wait = 0.0;
    return fl_wait(time_to_wait);
  }

Fl_Widget::draw() is called from within flush(). Adding a callback using Fl::add_timeout() affects the time that fl_wait would have to wait, but time_to_wait is not updated in this case. As a result time_to_wait is wrong and fl_wait may wait forever and the callback is not invoked in time.
 
 
#2 AlbrechtS
04:27 Sep 02, 2016
Thanks for the report and the investigation.

Your analysis looks sensible. According to the code involved this is indeed platform-specific (Unix/Linux/X11), but I can't rule out that other platforms are concerned as well (different code/source files).

Please test attached patch "check_timer_after_flush.patch" (use 'patch -p1' to apply).

Note: this patch is untested, but I think it should solve the issue at hand and don't do any harm. Code review and comments by others appreciated.

@OP: Does this patch solve the issue for you?

PS: if you could provide a short, complete, compileable example program this could speed up testing and implementation of the patch.
 
 
#3 AlbrechtS
07:50 Sep 02, 2016
I tested the behavior with and w/o the patch under Linux with the attached demo program 'str-3188_add_timeout.cxx':

(a) The timer is not called w/o the patch unless other events are delivered, for instance moving the mouse over the window.

(b) The previously uploaded patch fixes this.

Side note: I also tested under Windows: the behavior is correct in svn current (the demo program works as expected).
 
 
#4 AlbrechtS
09:02 Dec 09, 2019
Fixed in Git repository.

Fixed in 1.3.6 (770663920e00d9e3922f5e0cf93960a43e4c2657).
Fixed in 1.4.0 (0a124ac7e1b7c6210cd03ecf5d24bee2493bcc16).

Closed w/resolution.
 
bottom left image   bottom right image

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.