unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Russell Sim <russell.sim@gmail.com>
Cc: cyd@gnu.org, 11984@debbugs.gnu.org
Subject: bug#11984: 24.1; segfault while deleting a window
Date: Sat, 21 Jul 2012 12:32:43 +0300	[thread overview]
Message-ID: <83pq7p7938.fsf@gnu.org> (raw)
In-Reply-To: <ygeobn9xzd7.fsf@marvin.home>

> From: Russell Sim <russell.sim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  11984@debbugs.gnu.org
> Date: Sat, 21 Jul 2012 19:00:36 +1000
> 
> > Hmm, I'm not sure the core file loaded properly for me.  Can you trigger
> > the crash with Emacs running in gdb?  Do you get the following strange
> > result from printing f->output_data?
> >
> > (gdb) p f->output_data
> > $4 = {
> >   tty = 0xc2, 
> >   x = 0xc2, 
> >   w32 = 0xc2, 
> >   ns = 0xc2, 
> >   nothing = 194
> > }
> 
> (gdb) p f->output_data
> $1 = {tty = 0x0, x = 0x0, w32 = 0x0, ns = 0x0, nothing = 0}

This is a FRAME_INITIAL_P frame.

> 2652:   BLOCK_INPUT;
> 2653:   hlinfo = MOUSE_HL_INFO (f);
> 2654:   /* We are going to free the glyph matrices of WINDOW, and with that
> 2655:      we might lose any information about glyph rows that have some of
> 2656:      their glyphs highlighted in mouse face.  (These rows are marked
> 2657:      with a non-zero mouse_face_p flag.)  If WINDOW indeed has some
> 2658:      glyphs highlighted in mouse face, signal to frame's up-to-date
> 2659:      hook that mouse highlight was overwritten, so that it will
> 2660:      arrange for redisplaying the highlight.  */
> 2661:   if (EQ (hlinfo->mouse_face_window, window))
> 2662:     {
> 2663:       hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
> 2664:       hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
> 2665:       hlinfo->mouse_face_window = Qnil;
> 2666:     }

That's it your problem: you didn't include the changes below, which
make sure mouse-highlight info is never accessed for 'initial' frame
types.  The changes below were only done on the trunk, they aren't in
the emacs-24 branch.

--- src/window.c	2012-06-01 03:41:03 +0000
+++ src/window.c	2012-06-16 07:18:44 +0000
@@ -2566,7 +2566,6 @@ window-start value is reasonable when th
   Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta;
   ptrdiff_t startpos IF_LINT (= 0);
   int top IF_LINT (= 0), new_top, resize_failed;
-  Mouse_HLInfo *hlinfo;
 
   w = decode_any_window (window);
   XSETWINDOW (window, w);
@@ -2647,19 +2646,23 @@ window-start value is reasonable when th
     }
 
   BLOCK_INPUT;
-  hlinfo = MOUSE_HL_INFO (f);
-  /* We are going to free the glyph matrices of WINDOW, and with that
-     we might lose any information about glyph rows that have some of
-     their glyphs highlighted in mouse face.  (These rows are marked
-     with a non-zero mouse_face_p flag.)  If WINDOW indeed has some
-     glyphs highlighted in mouse face, signal to frame's up-to-date
-     hook that mouse highlight was overwritten, so that it will
-     arrange for redisplaying the highlight.  */
-  if (EQ (hlinfo->mouse_face_window, window))
-    {
-      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
-      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
-      hlinfo->mouse_face_window = Qnil;
+  if (!FRAME_INITIAL_P (f))
+    {
+        Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+      /* We are going to free the glyph matrices of WINDOW, and with
+	 that we might lose any information about glyph rows that have
+	 some of their glyphs highlighted in mouse face.  (These rows
+	 are marked with a non-zero mouse_face_p flag.)  If WINDOW
+	 indeed has some glyphs highlighted in mouse face, signal to
+	 frame's up-to-date hook that mouse highlight was overwritten,
+	 so that it will arrange for redisplaying the highlight.  */
+      if (EQ (hlinfo->mouse_face_window, window))
+	{
+	  hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+	  hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+	  hlinfo->mouse_face_window = Qnil;
+	}
     }
   free_window_matrices (r);
 
@@ -3903,7 +3906,6 @@ Signal an error when WINDOW is the only 
       && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
     /* We can delete WINDOW now.  */
     {
-      Mouse_HLInfo *hlinfo;
 
       /* Block input.  */
       BLOCK_INPUT;
@@ -3911,9 +3913,13 @@ Signal an error when WINDOW is the only 
 
       /* If this window is referred to by the dpyinfo's mouse
 	 highlight, invalidate that slot to be safe (Bug#9904).  */
-      hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-      if (EQ (hlinfo->mouse_face_window, window))
-	hlinfo->mouse_face_window = Qnil;
+      if (!FRAME_INITIAL_P (f))
+	{
+	  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+	  if (EQ (hlinfo->mouse_face_window, window))
+	    hlinfo->mouse_face_window = Qnil;
+	}
 
       windows_or_buffers_changed++;
       Vwindow_list = Qnil;






  reply	other threads:[~2012-07-21  9:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 22:08 bug#11984: 24.1; segfault while deleting a window Russell Sim
2012-07-19  3:05 ` Eli Zaretskii
2012-07-19  3:39   ` Chong Yidong
2012-07-19 10:41     ` martin rudalics
2012-07-21  6:18       ` Chong Yidong
2012-07-21 11:03         ` martin rudalics
2012-07-24 12:46           ` martin rudalics
2012-07-24 16:36             ` Eli Zaretskii
2012-07-25  7:15               ` martin rudalics
2012-07-25 15:27                 ` Eli Zaretskii
2012-07-26  9:43                   ` martin rudalics
2012-07-26 13:58                     ` martin rudalics
2012-08-14  9:09                   ` martin rudalics
2012-07-20 23:44     ` Russell Sim
2012-07-21  0:12       ` Russell Sim
2012-07-21  6:31         ` Chong Yidong
2012-07-21  9:00           ` Russell Sim
2012-07-21  9:32             ` Eli Zaretskii [this message]
2012-07-21  9:45               ` Russell Sim
2012-07-21 12:04                 ` Eli Zaretskii
2012-07-21  8:02         ` Eli Zaretskii
2012-07-21  9:08           ` Russell Sim

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=83pq7p7938.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=11984@debbugs.gnu.org \
    --cc=cyd@gnu.org \
    --cc=russell.sim@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).