mono / libgdiplus

C-based implementation of the GDI+ API
http://www.mono-project.com/
MIT License
334 stars 171 forks source link

WIP: Fix ownership of GpFontFamily objects returned by GdipGetFontCollectionFamilyList #637

Closed filipnavara closed 4 years ago

filipnavara commented 4 years ago

The returned objects are owned by GpFontCollection and the font collection is responsible for their lifetime. The managed implementation of System.Drawing in Mono and System.Drawing.Common in .NET Core already treated the ownership correctly which resulted in memory leaks. Change GdipDeleteFontFamily to detect accidental attempts to delete the font family objects.

filipnavara commented 4 years ago

The approach is flawed for private font collections which are dynamic; will have to investigate the behavior more closely and fix it in different way.