FLTK logo

STR #3382

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.3 | Post Text | Post File | SVN ⇄ GIT | Prev | Next ]

STR #3382

Application:FLTK Library
Status:5 - New
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:2 - Specific to an operating system
Subsystem:WIN32
Summary:wrong DC clean-up on Windows
Version:1.3.4
Created By:dstarke
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]
Name/Time/Date Filename/Size  
 
#1 dstarke
11:08 Apr 26, 2017
dc-cleanup.patch
3k
 
     

Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
 
#1 dstarke
11:08 Apr 26, 2017
Dr.Memory reported some GDI misuses which are mainly false-positive due to https://github.com/DynamoRIO/drmemory/issues/1552.
However, I still discovered some miuses.
Basically we store the state of the DC (SaveDC) right after creation, perform our drawing, clipping, etc. and restore it (RestoreDC)
before we delete the device context.
The function fl_makeDC() in Fl_Double_Window.cxx creates a DC and assignes a bitmap to it before we store the context state.
This creates a possible memory leak. The old bitmap will never be freed.
Furthermore, the destructor of Fl_Win32_At_Exit first deletes all objects assigned to the window device contexts and than the
contexts themself. This is not wrong by default, as we always restore the initial state before we delete a context, however,
deleting the DCs first leaves less chances that we miss something out.

Both issues are fixed in the attached patch.

I cannot confirm the correctness of the patch with Dr.Memory due to the mentioned false-positive bug.
I am also not sure if this breaks the ABI as it changes the signature of fl_makeDC() which is being exported,
though the user cannot access it without explicitly importing this symbol at the moment.
 
     

Return to Bugs & Features | Post Text | Post File ]

 
 

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