| [ Return to Bugs & Features | Roadmap 1.3 | Post Text | Post File | 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: | |
Trouble Report Files:
[ Post File ]
Trouble Report Comments:
[ Post 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 ]
|
| |