all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gazally@runbox.com, 33294@debbugs.gnu.org, lg.zevlg@gmail.com,
	monnier@iro.umontreal.ca
Subject: bug#33294: xwidget-insert crashes Emacs
Date: Mon, 26 Nov 2018 15:02:21 +0100	[thread overview]
Message-ID: <m2o9acszrm.fsf@gmail.com> (raw)
In-Reply-To: <CAO=W_ZoLGOP=YhPNEMhQPtsrk_N=BuNDyf1K+VYUuqoM=doCLw@mail.gmail.com>

Eli Zaretskii <eliz@gnu.org> writes:

>> Than this is a separate problem.  Looks like we need some flag to know
>> whether GTK has been initiaized (set in xg_initialize), and if not,
>> error out of make-xwidget and maybe xwidget_init_view.
>> 
>> I don't have access to an Emacs with xwidget support to test this; can
>> someone please provide a patch for that?

Something like this? (with ChangeLog etc of course). I couldn't come
up with a test-case for the xwidget_init_view path, but it causes
make-xwidget to error out under '-nw'

Robert

diff --git c/src/gtkutil.c i/src/gtkutil.c
index da4a0ae13d..4e4c953da2 100644
--- c/src/gtkutil.c
+++ i/src/gtkutil.c
@@ -5321,6 +5321,8 @@ xg_initialize (void)
 #ifdef HAVE_FREETYPE
   x_last_font_name = NULL;
 #endif
+
+  xg_gtk_initialized = true;
 }
 
 #endif /* USE_GTK */
diff --git c/src/gtkutil.h i/src/gtkutil.h
index 7dcd549f5c..3b074073e4 100644
--- c/src/gtkutil.h
+++ i/src/gtkutil.h
@@ -202,5 +202,6 @@ extern void xg_initialize (void);
    to indicate that the callback should do nothing.  */
 extern bool xg_ignore_gtk_scrollbar;
 
+extern bool xg_gtk_initialized;
 #endif /* USE_GTK */
 #endif /* GTKUTIL_H */
diff --git c/src/xwidget.c i/src/xwidget.c
index 6faac10751..6da7a0bb3f 100644
--- c/src/xwidget.c
+++ i/src/xwidget.c
@@ -78,6 +78,8 @@ Returns the newly constructed xwidget, or nil if construction fails.  */)
    Lisp_Object title, Lisp_Object width, Lisp_Object height,
    Lisp_Object arguments, Lisp_Object buffer)
 {
+  if (!xg_gtk_initialized)
+    error ("make-xwidget: GTK has not been initialized");
   CHECK_SYMBOL (type);
   CHECK_FIXNAT (width);
   CHECK_FIXNAT (height);
@@ -513,6 +515,10 @@ xwidget_init_view (struct xwidget *xww,
                    struct glyph_string *s,
                    int x, int y)
 {
+
+  if (!xg_gtk_initialized)
+    error ("xwidget_init_view: GTK has not been initialized");
+
   struct xwidget_view *xv = allocate_xwidget_view ();
   Lisp_Object val;
 





  reply	other threads:[~2018-11-26 14:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06 21:13 bug#33294: xwidget-insert crashes Emacs Evgeny Zajcev
2018-11-07  4:40 ` Eli Zaretskii
2018-11-07 16:16   ` Andy Moreton
2018-11-08  9:45     ` Eli Zaretskii
2018-11-08 13:01       ` Andy Moreton
     [not found]   ` <CAO=W_ZqJZ0APsO1skAs+1vh8KXs+JWR7YAiHNKuWV3VdmDmU8g@mail.gmail.com>
2018-11-08  4:54     ` Eli Zaretskii
2018-11-08 13:44       ` Evgeny Zajcev
2018-11-08 14:49         ` Eli Zaretskii
2018-11-08 16:21           ` Robert Pluim
2018-11-08 18:47             ` Eli Zaretskii
2018-11-08 20:15               ` Stefan Monnier
2018-11-09  7:44                 ` Eli Zaretskii
2018-11-09 13:16                   ` Robert Pluim
2018-11-09 13:29                   ` Stefan Monnier
2018-11-09 13:46                     ` Robert Pluim
2018-11-09 14:37                       ` Stefan Monnier
2018-11-09 14:57                         ` Robert Pluim
2018-11-09 14:56                     ` Eli Zaretskii
2018-11-09 16:11                       ` Stefan Monnier
2018-11-12 14:44                       ` Evgeny Zajcev
2018-11-12 16:11                         ` Eli Zaretskii
2018-11-13 11:43                           ` Evgeny Zajcev
2018-11-16  8:32                             ` Eli Zaretskii
2018-11-24  8:15                               ` Eli Zaretskii
2018-11-26 14:02                                 ` Robert Pluim [this message]
2018-11-26 16:27                                   ` Eli Zaretskii
2018-11-27  7:54                                     ` Eli Zaretskii
2018-11-27  9:33                                       ` Robert Pluim
2018-11-27  8:43                                     ` Robert Pluim
2018-11-27  9:12                                       ` Eli Zaretskii
2018-11-09 18:09                     ` Glenn Morris
2018-11-10  2:23                       ` Stefan Monnier

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=m2o9acszrm.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=33294@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gazally@runbox.com \
    --cc=lg.zevlg@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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.