Skip to content

Commit 8757bcf

Browse files
caesayclaude
andcommitted
Prevent GLib from calling abort() on critical/fatal messages
Set g_log_set_always_fatal(0) to disable GLib's abort-on-critical behavior. Also suppress ALL log levels (including FATAL) to prevent any GLib message from crashing the process during shutdown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 03c3f94 commit 8757bcf

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

msi-interop/handle_table.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,6 @@ handle_table_close_all(void)
299299
}
300300
g_free(to_unref);
301301

302-
// Shut down libgsf to prevent crashes during DLL unload.
303-
// Must be called after all GsfInput/GsfOutput objects are freed.
304-
gsf_shutdown();
305-
306302
return count;
307303
}
308304

@@ -327,12 +323,12 @@ handle_table_auto_init(void)
327323
g_type_ensure(libmsi_summary_info_get_type());
328324
handle_table_init();
329325

330-
// Suppress GLib log messages on stderr that cause test runners to
331-
// detect false "crashes" during process shutdown cleanup.
332-
GLogLevelFlags suppressed = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING;
333-
g_log_set_handler("GLib-GObject", suppressed, silent_log_handler, NULL);
334-
g_log_set_handler("GLib", suppressed, silent_log_handler, NULL);
335-
g_log_set_handler("GIO", suppressed, silent_log_handler, NULL);
336-
g_log_set_handler("libmsi", suppressed, silent_log_handler, NULL);
326+
// Prevent GLib from calling abort() on critical messages and suppress
327+
// all log output that can confuse test runners during process shutdown.
328+
g_log_set_always_fatal(0);
337329
g_log_set_default_handler(silent_log_handler, NULL);
330+
g_log_set_handler("GLib-GObject", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, silent_log_handler, NULL);
331+
g_log_set_handler("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, silent_log_handler, NULL);
332+
g_log_set_handler("GIO", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, silent_log_handler, NULL);
333+
g_log_set_handler("libmsi", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL, silent_log_handler, NULL);
338334
}

0 commit comments

Comments
 (0)