Prevent gtest tests from popping up dialog boxes

Charlie Barto requested to merge barcharcraz/glib:barch/windows_no_popups into main

Many UCRT (and msvcrt/msvcxx) functions open dialog boxes by default, for .... some reason. This is a problem because a test runner waiting on a process to exit won't see it exit unless someone actually clicks away the box, which won't happen on a CI machine.

Additionally, g_abort unconditionally raises a debugging exception, which, if uncaught, will cause windows error reporting to pop a dialog

Resolve the first problem by calling platform specific (but documented) functions to change the CRT's behavior in g_test_init. This is conditional on G_PLATFORM_WIN32 and not G_OS_WIN32 under the assumption that a hypothetical win32 target with some other C runtime would have a different G_PLATFORM (I'm not 100% sure this is right). The MS CRT doesn't define any crt specific macros, except for _UCRT which is only defined for the new UCRT version.

Resolve the second by only throwing a debug exception if we're under debugging, and just calling abort() otherwise.

This reduces the number of popups triggered by meson test from over 10 to about three on my machine, mostly in the spawn test code.

Merge request reports