FLTK logo

STR #333

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 #333

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:5 - Critical, e.g. nothing working at all
Scope:2 - Specific to an operating system
Subsystem:MacOS
Summary:Fl_mac.cxx patch for leaking CreateEvent()
Version:1.1.4
Created By:greg.ercolano
Assigned To:mike
Fix Version:1.1.5rc1
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 greg.ercolano
20:33 Apr 03, 2004
Fl_mac-1.1.4.patch
1k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 greg.ercolano
20:33 Apr 03, 2004
See patch against 1.1.4 (attached).

This bug is experienced ONLY by OSX apps that use Fl::add_fd().. probably a rare combination.

I noticed the following code in the 'dataready_thread()' function in Fl_mac.cxx creates an event with CreateEvent() that is not released with ReleaseEvent():

----
static void *dataready_thread(void *userdata)
{
  EventRef drEvent;
  CreateEvent( 0, kEventClassFLTK, kEventFLTKDataReady,
               0, kEventAttributeUserEvent, &drEvent);
  EventQueueRef eventqueue = (EventQueueRef)userdata;
----

This appears to be leaking resources, as each time the code is called, drEvent gets larger.

The fix is to re-locate the above 4 lines of code down to the 'default' switch, so ReleaseEvent() can be called immediately after the message is sent, eg:

----
      default:  // DATA READY
      {
        DEBUGMSG("DATA READY EVENT: SENDING\n");
        EventRef drEvent;
        CreateEvent( 0, kEventClassFLTK, kEventFLTKDataReady,
                     0, kEventAttributeUserEvent, &drEvent);
        EventQueueRef eventqueue = (EventQueueRef)userdata;
        PostEventToQueue(eventqueue, drEvent, kEventPriorityStandard );
        ReleaseEvent( drEvent );
        return(NULL);           // done with thread
      }
----

See patch.
 
 
#2 mike
08:15 Apr 06, 2004
Fixed in CVS - the anonymous CVS repository will be updated at midnight PST.  
     

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'.