From e2ec0af2b6410b1bb65f445e0cbf69c729eeb670 Mon Sep 17 00:00:00 2001
From: Matt Birkholz <matt@birkholz.chandler.az.us>
Date: Fri, 15 Jul 2011 17:32:20 -0700
Subject: [PATCH] Fixed start_gtk to be FALSE when gtk_init_check fails.

---
 src/gtk/gtkio.c.stay | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gtk/gtkio.c.stay b/src/gtk/gtkio.c.stay
index d7ff9609b..c04a24c14 100644
--- a/src/gtk/gtkio.c.stay
+++ b/src/gtk/gtkio.c.stay
@@ -316,14 +316,17 @@ start_gtk (int *argc, char ***argv)
      successful.  Returns FALSE when gtk_init_check failed, or
      gtk_main is already running. */
 
+  gboolean initted = FALSE;
+
   if (scheme_source != NULL)
-    return (FALSE);
+    return (initted);
 
   g_thread_init (NULL);
   gdk_threads_init ();
   gdk_threads_enter ();
+
   if (gtk_init_check (argc, argv)) {
-    gboolean ret = TRUE;
+    initted = TRUE;
     CalloutTrampIn tramp = &Scm_continue_start_gtk;
 
     /* Prep the machine for re-entry via scheme_source->dispatch(),
@@ -331,7 +334,7 @@ start_gtk (int *argc, char ***argv)
        C-CALL-CONTINUE, which should call Scm_continue_start_gtk().
        That function expects one gboolean in the top CSTACK frame. */
     callout_unseal (tramp);
-    CSTACK_PUSH (gboolean, ret);
+    CSTACK_PUSH (gboolean, initted);
     CSTACK_PUSH (int, cstack_depth);
     CSTACK_PUSH (CalloutTrampIn, tramp);
 
@@ -340,7 +343,7 @@ start_gtk (int *argc, char ***argv)
     destroy_scheme_source ();
   }
   gdk_threads_leave ();
-  return TRUE;
+  return initted;
 }
 
 void
-- 
2.25.1