From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#7464: 24.0.50; mouse highlighting vanishes upon unsplitting window Date: Wed, 28 Mar 2012 20:56:14 +0200 Message-ID: <83mx70imgh.fsf@gnu.org> References: <877hg5l828.fsf@escher.home> <8362vp9rci.fsf@gnu.org> <83y68l88xd.fsf@gnu.org> <87sjh12a0d.fsf@gnu.org> <871uolhmdx.fsf@escher.home> <83d381u9xy.fsf@gnu.org> <87limpoenv.fsf@escher.home> <83vclts5aq.fsf@gnu.org> <87pqc0bzyp.fsf@escher.home> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1332961490 23074 80.91.229.3 (28 Mar 2012 19:04:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Mar 2012 19:04:50 +0000 (UTC) Cc: cyd@gnu.org, 7464@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Mar 28 21:04:48 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SCyAl-0003tV-0J for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Mar 2012 21:04:43 +0200 Original-Received: from localhost ([::1]:59054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCyAk-0005KN-9S for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Mar 2012 15:04:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCy24-0003JQ-VA for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 14:55:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCy21-000602-5w for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 14:55:44 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCy21-0005zk-1C for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 14:55:41 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SCyWM-0008QP-UW for bug-gnu-emacs@gnu.org; Wed, 28 Mar 2012 15:27:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Mar 2012 19:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7464 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7464-submit@debbugs.gnu.org id=B7464.133296277932298 (code B ref 7464); Wed, 28 Mar 2012 19:27:02 +0000 Original-Received: (at 7464) by debbugs.gnu.org; 28 Mar 2012 19:26:19 +0000 Original-Received: from localhost ([127.0.0.1]:43661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCyVe-0008Os-Cl for submit@debbugs.gnu.org; Wed, 28 Mar 2012 15:26:19 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:45198) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCyV5-0008Ns-Cy for 7464@debbugs.gnu.org; Wed, 28 Mar 2012 15:26:16 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0M1L00H00YWAVT00@a-mtaout23.012.net.il> for 7464@debbugs.gnu.org; Wed, 28 Mar 2012 20:54:18 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.228.32.40]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1L00HX2Z6GTZ40@a-mtaout23.012.net.il>; Wed, 28 Mar 2012 20:54:18 +0200 (IST) In-reply-to: <87pqc0bzyp.fsf@escher.home> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:58259 Archived-At: > From: Stephen Berman > Cc: cyd@gnu.org, 7464@debbugs.gnu.org > Date: Sun, 25 Mar 2012 14:57:18 +0200 > > >> why do I not see the bug in Emacs 23? (And why does Chong Yidong > >> not see it in Emacs 24?) > > > > I don't know. I can describe in detail what I saw in the debugger and > > where, and then you and Chong could step through the same places and > > see what, if anything, is different for you there. > > It would interest me to try, when you have the time. Here's what I see in GDB when I step through Emacs 24 code (delete-other-windows-internal): (gdb) break Fdelete_other_windows_internal Breakpoint 3 at 0x11e73c0: file window.c, line 2572. (gdb) r -q Starting program: D:\usr\emacs\src/./oo/i386/emacs.exe -q [New Thread 5492.0x458] [New Thread 5492.0x824] [New Thread 5492.0x17e4] Breakpoint 3, Fdelete_other_windows_internal (window=56121349, root=53254170) at window.c:2572 2572 w = decode_any_window (window); (gdb) n 2573 XSETWINDOW (window, w); (gdb) p w->current_matrix $1 = (struct glyph_matrix *) 0x348c980 (gdb) p w->current_matrix->rows $2 = (struct glyph_row *) 0x40e4000 (gdb) p (w->current_matrix->rows+1)->mouse_face_p $3 = 1 Here we see the values of the window's current_matrix glyph matrix, and the pointer to the first glyph row of the matrix. We also see that the second row (== screen line) has the mouse_face_p flag set, which tells redisplay that some of this row's glyphs are shown in mouse face. Stepping further: (gdb) n 2574 f = XFRAME (w->frame); (gdb) 2576 if (NILP (root)) (gdb) 2579 root = FRAME_ROOT_WINDOW (f); (gdb) 2580 r = XWINDOW (root); (gdb) 2596 if (EQ (window, root)) (gdb) 2602 else if (MINI_WINDOW_P (w)) /* && top > 0) */ (gdb) 2605 if (!NILP (w->buffer)) (gdb) 2607 startpos = marker_position (w->start); (gdb) 2608 top = WINDOW_TOP_EDGE_LINE (w) (gdb) 2611 if (!EQ (window, FRAME_SELECTED_WINDOW (f))) (gdb) 2650 BLOCK_INPUT; (gdb) 2651 free_window_matrices (r); (gdb) p (w->current_matrix->rows+1)->mouse_face_p $4 = 1 (gdb) p w->current_matrix $5 = (struct glyph_matrix *) 0x348c980 (gdb) p w->current_matrix->rows $6 = (struct glyph_row *) 0x40e4000 Still the same values of the pointers. But when we step over the call to free_window_matrices, we get this: (gdb) n 2653 windows_or_buffers_changed++; (gdb) p w->current_matrix $7 = (struct glyph_matrix *) 0x0 The glyph matrix was freed and its pointer is now NULL. And then the call to adjust_glyphs allocates a new glyph matrix, with different pointers: (gdb) until 2772 Fdelete_other_windows_internal (window=56121349, root=53328389) at window.c:2772 2772 adjust_glyphs (f); (gdb) p w->current_matrix $10 = (struct glyph_matrix *) 0x0 (gdb) n 2773 UNBLOCK_INPUT; (gdb) p w->current_matrix $11 = (struct glyph_matrix *) 0x348c880 (gdb) p w->current_matrix->rows $12 = (struct glyph_row *) 0x413b000 However, the mouse_face_p flag is of course reset in this newly allocated matrix: (gdb) p (w->current_matrix->rows+1)->mouse_face_p $13 = 0 A similar picture is seen in Emacs 23.3 (I didn't have 23.4 where I tried this, sorry): (gdb) break Fdelete_other_windows Breakpoint 3 at 0x10d5476: file window.c, line 2501. (gdb) r -q Starting program: D:\usr\emacs-23.3\src/./oo/i386/emacs.exe -q [New Thread 3240.0x11f8] [New Thread 3240.0x628] [New Thread 3240.0xe40] Breakpoint 3, Fdelete_other_windows (window=45307906) at window.c:2501 2501 if (NILP (window)) (gdb) n 2502 window = selected_window; (gdb) 2505 w = XWINDOW (window); (gdb) 2507 startpos = marker_position (w->start); (gdb) p w $1 = (struct window *) 0x3824800 (gdb) p $1->current_matrix $2 = (struct glyph_matrix *) 0x2f18c00 (gdb) p $1->current_matrix->rows $3 = (struct glyph_row *) 0x2d6a000 (gdb) p ($1->current_matrix->rows+1)->mouse_face_p $4 = 1 Again, the mouse_face_p flag is set on the second glyph row. Now let's step into window_loop: (gdb) n 2508 top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAM E (w))); (gdb) 2510 if (MINI_WINDOW_P (w) && top > 0) (gdb) 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) s window_loop (type=DELETE_OTHER_WINDOWS, obj=58869765, mini=0, frames=58867717) at window.c:2191 2191 if (FRAMEP (frames)) (gdb) n 2192 f = XFRAME (frames); (gdb) 2198 if (f) (gdb) 2199 frame_arg = Qlambda; (gdb) 2212 if (WINDOWP (obj)) (gdb) 2213 window = obj; (gdb) 2219 windows = window_list_1 (window, mini ? Qt : Qnil, frame_arg); (gdb) 2221 best_window = Qnil; (gdb) 2223 for (; CONSP (windows); windows = XCDR (windows)) (gdb) 2227 window = XCAR (windows); (gdb) 2228 w = XWINDOW (window); (gdb) 2233 if (!MINI_WINDOW_P (w) (gdb) 2237 switch (type) (gdb) 2274 if (!EQ (window, obj)) (gdb) 2223 for (; CONSP (windows); windows = XCDR (windows)) (gdb) 2227 window = XCAR (windows); (gdb) 2228 w = XWINDOW (window); (gdb) 2233 if (!MINI_WINDOW_P (w) (gdb) 2237 switch (type) (gdb) 2274 if (!EQ (window, obj)) (gdb) 2275 Fdelete_window (window); And then into Fdelete_window: (gdb) s Fdelete_window (window=58900997) at window.c:1544 1544 if (NILP (window)) (gdb) n 1547 CHECK_LIVE_WINDOW (window); (gdb) p $1 $5 = (struct window *) 0x3824800 (gdb) up 2 #2 0x010d555d in Fdelete_other_windows (window=58869765) at window.c:2513 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) p $1->current_matrix $6 = (struct glyph_matrix *) 0x2f18c00 (gdb) p $1->current_matrix->rows $7 = (struct glyph_row *) 0x2d6a000 (gdb) down 2 #0 Fdelete_window (window=58900997) at window.c:1547 1547 CHECK_LIVE_WINDOW (window); (gdb) n 1549 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); (gdb) 1550 delete_window (window); And into delete_window: (gdb) s delete_window (window=58900997) at window.c:1569 1569 CHECK_WINDOW (window); (gdb) n 1570 p = XWINDOW (window); (gdb) 1573 if (NILP (p->buffer) (gdb) 1578 parent = p->parent; (gdb) 1579 if (NILP (parent)) (gdb) 1581 par = XWINDOW (parent); (gdb) until 1654 delete_window (window=58900997) at window.c:1654 1654 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (f))); You can see that it is going to free the matrices of the frame's root window. This will, of course, free all the glyph matrices of all the child windows on that frame. Observe: (gdb) up 3 #3 0x010d555d in Fdelete_other_windows (window=58869765) at window.c:2513 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) p w->current_matrix $8 = (struct glyph_matrix *) 0x2f18c00 (gdb) p w->current_matrix->rows $9 = (struct glyph_row *) 0x2d6a000 Before the call to free_window_matrices, the pointers are still intact. Now... (gdb) down 3 #0 delete_window (window=58900997) at window.c:1654 1654 free_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (f))); (gdb) n 1656 tem = p->next; (gdb) up 3 #3 0x010d555d in Fdelete_other_windows (window=58869765) at window.c:2513 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) p w->current_matrix $10 = (struct glyph_matrix *) 0x0 The matrix is a NULL pointer. And later: (gdb) until 1758 delete_window (window=58908165) at window.c:1758 1758 adjust_glyphs (f); (gdb) up 3 #3 0x010d555d in Fdelete_other_windows (window=58869765) at window.c:2513 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) p w->current_matrix $13 = (struct glyph_matrix *) 0x0 (gdb) down 3 #0 delete_window (window=58908165) at window.c:1758 1758 adjust_glyphs (f); (gdb) n 1759 UNBLOCK_INPUT; (gdb) up 3 #3 0x010d555d in Fdelete_other_windows (window=58869765) at window.c:2513 2513 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w)); (gdb) p w->current_matrix $14 = (struct glyph_matrix *) 0x3872000 (gdb) p w->current_matrix->rows $15 = (struct glyph_row *) 0x39ee000 As in Emacs 24, the call to adjust_glyphs reallocates a new glyph matrix for the window that is left on the frame, and the mouse_face_p flag is zero in that matrix. So, while the code was indeed rewritten, the problem that caused the bug was not affected: freeing the glyph matrix of the window without signaling to the display engine that it should recreate the mouse highlight on the next redisplay cycle.