DanielVanNoord / System.Windows.Forms

A .Net Core implementation of System.Windows.Forms based on Mono's System.Windows.Forms for Linux and Windows
Other
42 stars 4 forks source link

XplatUIX11: Fixed #5 double free or corruption (out) #7

Closed sancheolz closed 3 months ago

sancheolz commented 3 months ago

Fixed the native error double free or corruption (out) #5

The error occurred due to a chain of calls to region.GetHrgn (Graphics.FromHwnd(hwnd.whole_window)). Probably a Graphics object obtained from Graphics.FromHwnd could be released later or earlier than the Hwnd from which it was created. In mono, this code looks like region.GetHrgn (null); In the System.Drawing in mono returns null when passing NativeObject, and in System.Drawing.Common is thrown away ArgumentNullException. I tried not to create anything, but to transfer it to wParam (IntPtr)1. There were no problems during the checks.