[CC'ing the mailing list for input.]

Alexey Tourbin wrote:
I'm not sure if this patch can be applied as is, but there is a problem
with gtk_init.

gtk_init will terminate the program if the GUI cannot be initialized.
This can make syntax check impossible, which is too bad a consequence.
Hack gtk_init to invoke gtk_init_check in syntax check mode.

(old behaviour)
$ env -i perl -c -e 'use Gtk2 -init'
Gtk-WARNING **: cannot open display:  at 
/usr/lib/perl5/vendor_perl/x86_64-linux/Gtk2.pm line 138.
$

(new behaviour)
$ env -i perl -c -e 'use Gtk2 -init' -Mblib
-e syntax OK
$

---
 xs/Gtk2.xs |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xs/Gtk2.xs b/xs/Gtk2.xs
index 8fc0699..c9c06ff 100644
--- a/xs/Gtk2.xs
+++ b/xs/Gtk2.xs
@@ -328,7 +328,7 @@ gtk_init (class=NULL)
     CODE:
        pargv = gperl_argv_new ();
- if (ix == 2) {
+       if (ix == 2 || PL_minus_c) {
                RETVAL = gtk_init_check (&pargv->argc, &pargv->argv);
        } else {
                gtk_init (&pargv->argc, &pargv->argv);

I'm ambivalent about this. It fixes a real issue, but it does so by altering behavior in a way that doesn't seem completely safe. On the other hand, I can't think of any case where this change would cause undesired effects. Can you, gtk-perl-list?

In any case, the change would need an accompanying comment explaining the 
rationale.
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to