Menu

#3 Wrong calling convention on gdk_win32_drawable_get_handle

open
None
5
2011-04-12
2011-03-20
No

The calling convention of gdk_win32_drawable_get_handle is set to default. On windows the default calling convention is stdcall but GTK uses cdecl. This mismatch causes a memory leak because the stack is not cleaned up. Furthermore the PInvokeStackImbalance managed debugging assistant pops up every time a GlWidget is created in Visual Studio debug mode.

The calling convention should look like this:
[DllImport("libgdk-win32-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
public static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);

(In addition to that I don't think "SuppressUnmanagedCodeSecurity" which is used all over the place is a good idea. It adds little performance gain that seems completely irrelevant to me because the functions are only called at initialization of teh widget.)

Discussion

  • James Talton

    James Talton - 2011-04-12
    • assigned_to: nobody --> jtalton
     
  • James Talton

    James Talton - 2011-04-12

    Thanks for the bug report and fix! I'll integrate soon.

     

Log in to post a comment.

MongoDB Logo MongoDB