Subject: bug#30182: Update

From: martin rudalics <[email-masked]>
Date: Sun, 28 Jan 2018 09:26:47 +0100

>> If the crash still occurs please proceed as follows:
 >
 > I checked with master and the crash no longer happens.

Thanks for checking and for reporting this bug in the first place.  It
revealed an awfully silly, costly and completely unnecessary way of
implementing the desired behavior.

Yet, I'd still like to know why and how that crash happened.  So if
you have a few minutes to spend, please shortly undo the fix and try
the two things I asked in my other mail, namely to:

(1) Try with `x-gtk-use-system-tooltips' nil.  This should tell
     whether GTK tooltip handling interferes with our routines.

(2) Try the attached (again) diff.  When the crash occurs please do

     p old_len_0
     p new_len_0

     in the debugger and post the values it prints.  This should tell
     whether a timer is added while we construct the list for the copy.

Thanks again, martin
diff --git a/src/fns.c b/src/fns.c
index 47457e4..6fea5cd 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -546,6 +546,9 @@ struct textprop_rec
   struct textprop_rec  *textprops = NULL;
   /* Number of elements in textprops.  */
   ptrdiff_t num_textprops = 0;
+
+  EMACS_INT old_len_0, new_len_0;
+
   USE_SAFE_ALLOCA;
 
   tail = Qnil;
@@ -643,7 +646,11 @@ struct textprop_rec
 
   /* Create the output object.  */
   if (target_type == Lisp_Cons)
-    val = Fmake_list (make_number (result_len), Qnil);
+    {
+      old_len_0 = XFASTINT (Flength (args[0]));
+      val = Fmake_list (make_number (result_len), Qnil);
+      new_len_0 = XFASTINT (Flength (args[0]));
+    }
   else if (target_type == Lisp_Vectorlike)
     val = Fmake_vector (make_number (result_len), Qnil);
   else if (some_multibyte)