From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2zG2-0007p4-HZ for qemu-devel@nongnu.org; Thu, 11 Jun 2015 05:58:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2zFz-0000Hu-DE for qemu-devel@nongnu.org; Thu, 11 Jun 2015 05:58:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2zFz-0000Hg-86 for qemu-devel@nongnu.org; Thu, 11 Jun 2015 05:58:43 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A5E2D36B4EC for ; Thu, 11 Jun 2015 09:58:42 +0000 (UTC) From: Gerd Hoffmann Date: Thu, 11 Jun 2015 11:58:38 +0200 Message-Id: <1434016718-27631-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1434016718-27631-1-git-send-email-kraxel@redhat.com> References: <1434016718-27631-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/1] gtk: don't exit early in case gtk init fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrange --- ui/gtk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/gtk.c b/ui/gtk.c index 126326a..df2a79e 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -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); @@ -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 */ -- 1.8.3.1