[perl-Gtk2] In syntax check mode, do not call gtk_init



commit 7bb2cc383bba00d98e95b9d371c6f6589c905f31
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Apr 11 17:20:34 2010 +0200

    In syntax check mode, do not call gtk_init
    
    gtk_init may abort the program (e.g. if DISPLAY is not set), so in
    syntax check mode, only call gtk_init_check even if asked to call
    gtk_init.
    
    Original patch by Alexey Tourbin.

 xs/Gtk2.xs |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/xs/Gtk2.xs b/xs/Gtk2.xs
index f0e9871..ce71a53 100644
--- a/xs/Gtk2.xs
+++ b/xs/Gtk2.xs
@@ -333,7 +333,12 @@ gtk_init (class=NULL)
 
 	if (ix == 2) {
 		RETVAL = gtk_init_check (&pargv->argc, &pargv->argv);
-	} else {
+	} else if (PL_minus_c) {
+		/* When in syntax check mode, we need to avoid calling gtk_init
+		 * even if asked to because it might abort the program (e.g. if
+		 * DISPLAY is not set). */
+		RETVAL = gtk_init_check (&pargv->argc, &pargv->argv);
+        } else {
 		gtk_init (&pargv->argc, &pargv->argv);
 		/* gtk_init() either succeeds or does not return. */
 		RETVAL = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]