Subject: 27.0.50; segfault when starting from pdump and using dbus

From: Paul Eggert <[email-masked]>
Date: Wed, 11 Sep 2019 10:21:39 -0700

Thanks for reporting the problem. I reproduced it and installed the attached 
patch, which should fix it.
>From cc4da5b17e9e9aa522a0bd77dc341cd14ec9ea43 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Wed, 11 Sep 2019 10:19:07 -0700
Subject: [PATCH] Reset dbus registered buses on dump load

Problem reported by Leonard Lausen (Bug#37331).
* src/dbusbind.c: Include pdumper.h.
(syms_of_dbusbind_for_pdumper):
New function, to reset the registered buses.
(syms_of_dbusbind): Use it, fixing a TODO.
---
 src/dbusbind.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7f4c8717f4..de67dc94f9 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -26,6 +26,7 @@
 #include "lisp.h"
 #include "termhooks.h"
 #include "keyboard.h"
+#include "pdumper.h"
 #include "process.h"
 
 #ifndef DBUS_NUM_MESSAGE_TYPES
@@ -1681,6 +1682,12 @@ init_dbusbind (void)
   xputenv ("DBUS_FATAL_WARNINGS=0");
 }
 
+static void
+syms_of_dbusbind_for_pdumper (void)
+{
+  xd_registered_buses = Qnil;
+}
+
 void
 syms_of_dbusbind (void)
 {
@@ -1829,13 +1836,10 @@ syms_of_dbusbind (void)
 #endif
 
   /* Initialize internal objects.  */
-  xd_registered_buses = Qnil;
+  pdumper_do_now_and_after_load (syms_of_dbusbind_for_pdumper);
   staticpro (&xd_registered_buses);
 
-  // TODO: reset buses on dump load
-
   Fprovide (intern_c_string ("dbusbind"), Qnil);
-
 }
 
 #endif /* HAVE_DBUS */
-- 
2.17.1