GNU bug report logs -
#24041
25.1.50; xwidget + -nw mode gives segfault
Previous Next
Reported by: Shane Hansen <shanemhansen <at> gmail.com>
Date: Wed, 20 Jul 2016 16:08:02 UTC
Severity: normal
Found in version 25.1.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
>> (Is that even possible? Start a graphical frame from a tty Emacs?)
>
> Of course, it is. emacsclient can do that. Assuming Emacs was built
> with GUI support, of course. We have this feature for several years
> now.
>
Indeed it can. Never tried it before, and kinda assumed it wouldn't
work. Silly me.
Anyways, I have a patch, below, that's my first stab at solving the
problem. All it does is call `check_x_display_info` with the current
frame and allows any resulting error signals to propagate back up.
Probably not the most elegant solution, but I'm not entirely clear what
can and can't be done from within the Emacs C core. Suggestions are very
welcome.
-----
[0001-Signal-an-error-when-a-TTY-frame-tries-to-create-an-.patch (text/x-patch, inline)]
From 82532f657f7acc824745406e8917a1a4f49723d9 Mon Sep 17 00:00:00 2001
From: Robert Cochran <robert-git <at> cochranmail.com>
Date: Sun, 21 Aug 2016 19:01:14 -0700
Subject: [PATCH] Signal an error when a TTY frame tries to create an xwidget
* src/xwidget.c (make-xwidget): signal an error if current frame is a
TTY frame.
Trying to use a TTY frame to create an xwidget can cause a
segfault. Check before hand that the frame is an X frame via
check_x_display_info, which will signal an error if it is not. This
fixes Bug#24041.
---
src/xwidget.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/xwidget.c b/src/xwidget.c
index f5f4da0..0edfacc 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -99,8 +99,15 @@ Returns the newly constructed xwidget, or nil if construction fails. */)
CHECK_NATNUM (width);
CHECK_NATNUM (height);
- struct xwidget *xw = allocate_xwidget ();
+ struct xwidget *xw;
Lisp_Object val;
+
+ /* Ensure that the current frame is an X frame before we try
+ creating any xwidgets. If it isn't, check_x_display_info will
+ signal an error. */
+ check_x_display_info (Fselected_frame ());
+
+ xw = allocate_xwidget ();
xw->type = type;
xw->title = title;
xw->buffer = NILP (buffer) ? Fcurrent_buffer () : Fget_buffer_create (buffer);
--
2.7.4
[Message part 3 (text/plain, inline)]
-----
HTH,
--
~Robert Cochran
GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26 AD2D E5C3 EB36 4886 8871
This bug report was last modified 5 years and 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.