Skip to content

GWin32: Add g_win32_com_clear()

Chun-wei Fan requested to merge win32-clear-com into main

Hi,

As we are in the process of updating and modernizing the Windows support code in GTK and Pango, we are dealing more with Windows COM objects, so I thought it might be a good idea to add a macro (or templatized implementation for C++) to release and reset those objects, more or less like what g_clear_object() does.

Notice that there is a separate C++ version as there are COM objects that are only shipped with C++ interfaces, such as DirectWrite and Direct2D that is shipped with the Windows SDK, albeit being provided with the mingw-w64 toolchain.

Hi @pwithnall: I believe that test(s) are preferable for adding items like this to GLib-Win32 to you, so I am listing this MR as WIP for now, as I will look into adding test(s) for this at a later stage.

With blessings, thank you!

Merge request reports

Loading