unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: 5984@debbugs.gnu.org
Subject: bug#5984: Crash displaying composed characters
Date: Wed, 21 Apr 2010 14:33:59 +0200	[thread overview]
Message-ID: <m24oj5dlxk.fsf@igel.home> (raw)
In-Reply-To: <h2pf7ccd24b1004210348y597ac4aes490bea38fe10e0a3@mail.gmail.com> (Juanma Barranquero's message of "Wed, 21 Apr 2010 12:48:37 +0200")

Juanma Barranquero <lekktu@gmail.com> writes:

>> Please try this patch.
>
> With it, I don't get a crash, but an error:
>
>   Wrong type argument: bufferp, 12846208

Here's an updated patch.

Andreas.

=== modified file 'src/composite.c'
--- src/composite.c	2010-01-14 03:54:04 +0000
+++ src/composite.c	2010-04-21 12:10:13 +0000
@@ -986,20 +986,31 @@ autocmp_chars (cft_element, charpos, byt
 	    font_object = win->frame;
 	  gstring = Fcomposition_get_gstring (pos, make_number (to),
 					      font_object, string);
-	  if (NILP (LGSTRING_ID (gstring)))
+	  if (!NILP (LGSTRING_ID (gstring)))
 	    {
-	      Lisp_Object args[6];
-
-	      args[0] = Vauto_composition_function;
-	      args[1] = AREF (elt, 2);
-	      args[2] = pos;
-	      args[3] = make_number (to);
-	      args[4] = font_object;
-	      args[5] = string;
-	      gstring = safe_call (6, args);
+	      if (NILP (string))
+		TEMP_SET_PT_BOTH (pt, pt_byte);
+	      return unbind_to (count, gstring);
 	    }
+
+	  /* Save point as marker before calling out to lisp.  */
 	  if (NILP (string))
-	    TEMP_SET_PT_BOTH (pt, pt_byte);
+	    {
+	      Lisp_Object m = Fmake_marker ();
+	      set_marker_both (m, Qnil, pt, pt_byte);
+	      record_unwind_protect (restore_point_unwind, m);
+	    }
+	  {
+	    Lisp_Object args[6];
+
+	    args[0] = Vauto_composition_function;
+	    args[1] = AREF (elt, 2);
+	    args[2] = pos;
+	    args[3] = make_number (to);
+	    args[4] = font_object;
+	    args[5] = string;
+	    gstring = safe_call (6, args);
+	  }
 	  return unbind_to (count, gstring);
 	}
     }

=== modified file 'src/fileio.c'
--- src/fileio.c	2010-04-21 03:02:58 +0000
+++ src/fileio.c	2010-04-21 09:22:01 +0000
@@ -299,7 +299,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-04-21 03:02:58 +0000
+++ src/lisp.h	2010-04-21 09:22:01 +0000
@@ -3061,6 +3061,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, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."






  reply	other threads:[~2010-04-21 12:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 13:42 bug#5984: Crash displaying composed characters Juanma Barranquero
2010-04-20 15:06 ` Eli Zaretskii
2010-04-20 15:48   ` Juanma Barranquero
2010-04-20 16:07     ` Eli Zaretskii
2010-04-20 18:38       ` Glenn Morris
2010-04-20 17:29   ` Eli Zaretskii
2010-04-20 17:33     ` Juanma Barranquero
2010-04-20 17:52       ` Eli Zaretskii
2010-04-20 18:43         ` Lennart Borgman
2010-04-20 19:18     ` Eli Zaretskii
2010-04-20 20:38     ` Andreas Schwab
2010-04-21 10:48       ` Juanma Barranquero
2010-04-21 12:33         ` Andreas Schwab [this message]
2010-04-21 17:21           ` Juanma Barranquero
2010-04-23  9:17           ` Eli Zaretskii
2011-07-06  2:28             ` Juanma Barranquero
2011-08-07 19:45               ` Chong Yidong
2011-11-23  3:14                 ` Juanma Barranquero
2011-11-23  6:47                   ` Chong Yidong
2010-04-30 20:47     ` Stefan Monnier
2010-05-01  6:09       ` Eli Zaretskii
2010-05-01  6:28       ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24oj5dlxk.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=5984@debbugs.gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).