Subject: bug#57699: Assertion failure "lib_child_handler != dummy_handler"

From: Stefan Monnier <[email-masked]>
Date: Fri, 09 Sep 2022 11:27:07 -0400

> EEMPTYPATCH

Hmm... not sure how that happened.
Let's try again.

        Stefan
diff --git a/src/process.c b/src/process.c
index 7a133cda00f..331f7daf83e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8438,11 +8438,15 @@ init_process_emacs (int sockfd)
       catch_child_signal ();
       g_source_unref (source);
 
-      eassert (lib_child_handler != dummy_handler);
-      signal_handler_t lib_child_handler_glib = lib_child_handler;
-      catch_child_signal ();
-      eassert (lib_child_handler == dummy_handler);
-      lib_child_handler = lib_child_handler_glib;
+      /* Apparently more recent versions of glib do not set this handler
+         any more, so make sure the dance is needed before going for it.  */
+      if (lib_child_handler != dummy_handler)
+        {
+          signal_handler_t lib_child_handler_glib = lib_child_handler;
+          catch_child_signal ();
+          eassert (lib_child_handler == dummy_handler);
+          lib_child_handler = lib_child_handler_glib;
+        }
 #else
       catch_child_signal ();
 #endif