all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: 31373@debbugs.gnu.org
Subject: bug#31373: 26.1; frame-list-z-order segfaults on initial daemon frame
Date: Sun, 06 May 2018 10:14:13 -0400	[thread overview]
Message-ID: <87efiona6i.fsf@gmail.com> (raw)
In-Reply-To: <87sh747vsf.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 06 May 2018 14:34:08 +0100")

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

tags 31373 + patch
quit

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> On the latest emacs-26 and master branches, calling the function
> frame-list-z-order crashes a daemon Emacs via segfault:
>
> 1. ./src/emacs -Q --daemon=<name>
> 2. ./lib-src/emacsclient --socket-name=<name> --create-frame
> 3. cd src
> 4. gdb -p <PID of step (1)>
> 5. Issue 'continue' in gdb

You can also use

1. gdb ./emacs -Q --fg-daemon=<name>
2. Issue 'run' in gdb
3. ../lib-src/emacsclient --socket-name=<name> --create-frame

> 6. Evaluating (frame-list-z-order) in the emacsclient frame gives the
>    following output in gdb:
>
> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
> 0x0000000000565112 in x_frame_list_z_order (dpy=0x33018f0, window=227) at xfns.c:5306
> 5306		    if (XFRAME (frame)->output_data.x->parent_desc == children[i]

> A quick step-through of x_frame_list_z_order indicates that the members
> of the struct XFRAME (frame)->output_data are initialised to NULL for
> the initial daemon frame F1.

Right, I think we need to check the frame's output_method field first.
I wonder if there are other cases like this?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1152 bytes --]

From b2c13a02a88fc8cc00c61ef8f56719fbb9b02897 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs@gmail.com>
Date: Sun, 6 May 2018 10:07:25 -0400
Subject: [PATCH] Don't check non-X frames for z order (Bug#31373)

* src/xfns.c (x_frame_list_z_order): Only use frames with
`output_method' set to `output_x_window'.
---
 src/xfns.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/xfns.c b/src/xfns.c
index 20fe61bffd..29dd529e27 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5303,8 +5303,9 @@ x_frame_list_z_order (Display* dpy, Window window)
 	    /* With a reparenting window manager the parent_desc field
 	       usually specifies the topmost windows of our frames.
 	       Otherwise FRAME_OUTER_WINDOW should do.  */
-	    if (XFRAME (frame)->output_data.x->parent_desc == children[i]
-		|| FRAME_OUTER_WINDOW (XFRAME (frame)) == children[i])
+	    if (XFRAME (frame)->output_method == output_x_window
+                && (XFRAME (frame)->output_data.x->parent_desc == children[i]
+                    || FRAME_OUTER_WINDOW (XFRAME (frame)) == children[i]))
 	      frames = Fcons (frame, frames);
 	}
 
-- 
2.11.0


  reply	other threads:[~2018-05-06 14:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-06 13:34 bug#31373: 26.1; frame-list-z-order segfaults on initial daemon frame Basil L. Contovounesios
2018-05-06 14:14 ` Noam Postavsky [this message]
2018-05-06 14:58   ` Basil L. Contovounesios
2018-05-06 16:28     ` Noam Postavsky
2018-05-06 16:49       ` Eli Zaretskii
2018-05-06 17:09         ` Noam Postavsky
2018-05-06 17:03       ` Basil L. Contovounesios
2018-05-11  2:51         ` Noam Postavsky
2018-05-11  8:29           ` Basil L. Contovounesios
2018-05-07  6:26       ` martin rudalics
2018-05-07 17:59         ` Eli Zaretskii
2018-05-07 18:08           ` Noam Postavsky
2018-05-07 19:30             ` Eli Zaretskii
2018-05-08  1:40               ` Noam Postavsky

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

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

  git send-email \
    --in-reply-to=87efiona6i.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=31373@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.