[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 a291f62: Don't call xwidget functions until GTK h
From: |
Robert Pluim |
Subject: |
[Emacs-diffs] emacs-26 a291f62: Don't call xwidget functions until GTK has been initialized |
Date: |
Tue, 27 Nov 2018 03:42:10 -0500 (EST) |
branch: emacs-26
commit a291f624289bd2009b7fa230d62b5940e0484c83
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>
Don't call xwidget functions until GTK has been initialized
Follow up fix to Bug#33294.
* src/gtkutil.c: Define xg_gtk_initialized.
(xg_initialize): Set it when GTK has finished initializing.
* src/gtkutil.h: Declare xg_gtk_initialized.
* src/xwidget.c (Fmake_xwidget): Error out if GTK has not been
initialized.
(xwidget_init_view): Likewise.
---
src/gtkutil.c | 4 ++++
src/gtkutil.h | 1 +
src/xwidget.c | 6 ++++++
3 files changed, 11 insertions(+)
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 5879ab6..9540bd9 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -147,6 +147,8 @@ struct xg_frame_tb_info
GtkTextDirection dir;
};
+bool xg_gtk_initialized; /* Used to make sure xwidget calls are
possible */
+
static GtkWidget * xg_get_widget_from_map (ptrdiff_t idx);
@@ -5306,6 +5308,8 @@ xg_initialize (void)
#ifdef HAVE_FREETYPE
x_last_font_name = NULL;
#endif
+
+ xg_gtk_initialized = true;
}
#endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 7dcd549..3b07407 100644
--- a/src/gtkutil.h
+++ b/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 a/src/xwidget.c b/src/xwidget.c
index bcc450b..09c65d0 100644
--- a/src/xwidget.c
+++ b/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_NATNUM (width);
CHECK_NATNUM (height);
@@ -508,6 +510,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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 a291f62: Don't call xwidget functions until GTK has been initialized,
Robert Pluim <=