Subject: Re: bug#5984: Crash displaying composed characters

From: Andreas Schwab <[email-masked]>
Date: Tue, 20 Apr 2010 22:38:47 +0200

Please try this patch.

Andreas.

=== modified file 'src/composite.c'
--- src/composite.c	2010-01-14 03:54:04 +0000
+++ src/composite.c	2010-04-20 20:27:46 +0000
@@ -986,6 +986,14 @@ autocmp_chars (cft_element, charpos, byt
 	    font_object = win->frame;
 	  gstring = Fcomposition_get_gstring (pos, make_number (to),
 					      font_object, string);
+	  /* Calling auto-composition-function may modify the current
+	     buffer, save point as marker.  */
+	  if (NILP (string))
+	    {
+	      Lisp_Object m = Fmake_marker ();
+	      set_marker_both (m, current_buffer, pt, pt_byte);
+	      record_unwind_protect (restore_point_unwind, m);
+	    }
 	  if (NILP (LGSTRING_ID (gstring)))
 	    {
 	      Lisp_Object args[6];
@@ -998,8 +1006,6 @@ autocmp_chars (cft_element, charpos, byt
 	      args[5] = string;
 	      gstring = safe_call (6, args);
 	    }
-	  if (NILP (string))
-	    TEMP_SET_PT_BOTH (pt, pt_byte);
 	  return unbind_to (count, gstring);
 	}
     }

=== modified file 'src/fileio.c'
--- src/fileio.c	2010-02-18 09:02:04 +0000
+++ src/fileio.c	2010-04-20 20:27:46 +0000
@@ -302,7 +302,7 @@ close_file_unwind (fd)
 
 /* Restore point, having saved it as a marker.  */
 
-static Lisp_Object
+Lisp_Object
 restore_point_unwind (location)
      Lisp_Object location;
 {

=== modified file 'src/lisp.h'
--- src/lisp.h	2010-03-05 23:08:18 +0000
+++ src/lisp.h	2010-04-20 20:27:46 +0000
@@ -3018,6 +3018,7 @@ EXFUN (Ffile_readable_p, 1);
 EXFUN (Ffile_executable_p, 1);
 EXFUN (Fread_file_name, 6);
 extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
+extern Lisp_Object restore_point_unwind P_ ((Lisp_Object));
 extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN;
 extern int internal_delete_file P_ ((Lisp_Object));
 extern void syms_of_fileio P_ ((void));

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."