From: Robert Cochran <robert-emacs@cochranmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: shanemhansen@gmail.com, 24041@debbugs.gnu.org
Subject: bug#24041: 25.1.50; xwidget + -nw mode gives segfault
Date: Sun, 21 Aug 2016 19:12:41 -0700 [thread overview]
Message-ID: <878tvpa6w6.fsf@cochranmail.com> (raw)
In-Reply-To: <8360qudeuj.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 21 Aug 2016 05:40:20 +0300")
[-- Attachment #1: Type: text/plain, Size: 715 bytes --]
Eli Zaretskii <eliz@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.
-----
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to see if the frame is an X frame before creating xwidget --]
[-- Type: text/x-patch, Size: 1328 bytes --]
From 82532f657f7acc824745406e8917a1a4f49723d9 Mon Sep 17 00:00:00 2001
From: Robert Cochran <robert-git@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
[-- Attachment #3: Type: text/plain, Size: 102 bytes --]
-----
HTH,
--
~Robert Cochran
GPG Fingerprint - E778 2DD4 FEA6 6A68 6F26 AD2D E5C3 EB36 4886 8871
next prev parent reply other threads:[~2016-08-22 2:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 16:04 bug#24041: 25.1.50; xwidget + -nw mode gives segfault Shane Hansen
2016-08-19 18:36 ` Robert Cochran
2016-08-20 7:32 ` Eli Zaretskii
2016-08-20 21:33 ` Robert Cochran
2016-08-21 2:40 ` Eli Zaretskii
2016-08-22 2:12 ` Robert Cochran [this message]
2016-08-22 14:41 ` Eli Zaretskii
2016-08-22 18:30 ` Robert Cochran
2016-08-22 18:49 ` Eli Zaretskii
2016-08-22 19:52 ` joakim
2016-08-22 20:28 ` Robert Cochran
2016-08-23 2:40 ` Eli Zaretskii
2019-08-28 20:04 ` Lars Ingebrigtsen
2019-08-29 11:00 ` Robert Pluim
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=878tvpa6w6.fsf@cochranmail.com \
--to=robert-emacs@cochranmail.com \
--cc=24041@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=shanemhansen@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 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.