Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150611-1…
Browse files Browse the repository at this point in the history
…' into staging

gtk: don't exit early in case gtk init fails

# gpg: Signature made Thu Jun 11 10:38:29 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>"
# gpg:                 aka "Gerd Hoffmann <[email protected]>"
# gpg:                 aka "Gerd Hoffmann (private) <[email protected]>"

* remotes/kraxel/tags/pull-gtk-20150611-1:
  gtk: don't exit early in case gtk init fails

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed Jun 11, 2015
2 parents 0e12e61 + 060ab76 commit 39e16a5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1917,12 +1917,19 @@ static void gd_set_keycode_type(GtkDisplayState *s)
#endif
}

static gboolean gtkinit;

void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
{
GtkDisplayState *s = g_malloc0(sizeof(*s));
char *filename;
GdkDisplay *window_display;

if (!gtkinit) {
fprintf(stderr, "gtk initialization failed\n");
exit(1);
}

s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#if GTK_CHECK_VERSION(3, 2, 0)
s->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
Expand Down Expand Up @@ -2003,7 +2010,11 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)

void early_gtk_display_init(int opengl)
{
gtk_init(NULL, NULL);
gtkinit = gtk_init_check(NULL, NULL);
if (!gtkinit) {
/* don't exit yet, that'll break -help */
return;
}

switch (opengl) {
case -1: /* default */
Expand Down

0 comments on commit 39e16a5

Please sign in to comment.