GNU bug report logs - #33294
xwidget-insert crashes Emacs

Previous Next

Package: emacs;

Reported by: Evgeny Zajcev <lg.zevlg <at> gmail.com>

Date: Tue, 6 Nov 2018 21:15:01 UTC

Severity: normal

Tags: fixed

Fixed in version 26.2

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #89 received at 33294 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gazally <at> runbox.com, 33294 <at> debbugs.gnu.org, lg.zevlg <at> gmail.com,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#33294: xwidget-insert crashes Emacs
Date: Mon, 26 Nov 2018 15:02:21 +0100
Eli Zaretskii <eliz <at> 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;
 




This bug report was last modified 6 years and 256 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.