FLTK logo

STR #20

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   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.1 | SVN ⇄ GIT ]

STR #20

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:4 - High, e.g. key functionality not working
Scope:2 - Specific to an operating system
Subsystem:Core Library
Summary:Linux : Fl::remove_fd(int n, int events) - bug in maxfd calculation
Version:1.1.3
Created By:jh.ipmotion
Assigned To:mike
Fix Version:1.1.4
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files


Trouble Report Comments:


Name/Time/Date Text  
 
#1 jh.ipmotion
04:36 Apr 23, 2003
The maxfd-calculation seems to be broken, if callbacks are assigned for different events on a single fd. In that case, if only a single event for the current maxfd is removed, the maxfd must not be decreased until all events are removed for it, otherwise  the fd will no longer receive callbacks for the other events.
Proposed patch - calculate the maxfd on the fly :
--- Fl_x.cxx_originial Wed Apr 23 06:01:32 2003
+++ Fl_x.cxx Wed Apr 23 06:19:48 2003
@@ -123,6 +123,7 @@
 
 void Fl::remove_fd(int n, int events) {
   int i,j;
+  maxfd = -1; // recalculate maxfd on the fly
   for (i=j=0; i<nfds; i++) {
 #  if USE_POLL
     if (pollfds[i].fd == n) {
@@ -137,6 +138,7 @@
       fd[i].events = e;
     }
 #  endif
+    if (fd[i].fd > maxfd) maxfd = fd[i].fd;
     // move it down in the array if necessary:
     if (j<i) {
       fd[j] = fd[i];
@@ -151,7 +153,6 @@
   if (events & POLLIN) FD_CLR(n, &fdsets[0]);
   if (events & POLLOUT) FD_CLR(n, &fdsets[1]);
   if (events & POLLERR) FD_CLR(n, &fdsets[2]);
-  if (n == maxfd) maxfd--;
 #  endif
 }

 
 
#2 mike
13:32 May 04, 2003
Fixed in CVS for 1.1.4.  
     

Return to Bugs & Features ]

 
 

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