Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.

Commit 6a3b102

Browse files
caesayclaude
andcommitted
Add DLL destructor to clean up handles on unload
When the .NET test host exits, it unloads the DLL without calling MsiCloseAllHandles. This leaves GLib objects in a partially-freed state, causing g_object_unref crashes during GLib's atexit cleanup. Add a __attribute__((destructor)) that calls handle_table_close_all() and gsf_shutdown() to properly release all handles and shut down libgsf before the DLL is unloaded. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent abb58bc commit 6a3b102

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

msi-interop/handle_table.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,11 @@ handle_table_auto_init(void)
284284
g_type_ensure(libmsi_summary_info_get_type());
285285
handle_table_init();
286286
}
287+
288+
__attribute__((destructor))
289+
static void
290+
handle_table_auto_cleanup(void)
291+
{
292+
handle_table_close_all();
293+
gsf_shutdown();
294+
}

0 commit comments

Comments
 (0)