[perl-Gtk3] Avoid infinite recursion in Gtk3::disable_setlocale



commit 1819276931a23383c1d28fe23a3b22a9d76e131f
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Tue Dec 30 20:43:34 2014 +0100

    Avoid infinite recursion in Gtk3::disable_setlocale
    
    Its custom wrapper was written incorrectly.

 lib/Gtk3.pm |    7 +++----
 t/00-init.t |   15 ++++++++++-----
 2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 9eb81d8..4ad94ca 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -1492,10 +1492,10 @@ if ($^V ge v5.20.0) {
   no warnings 'redefine';
 
   my $disable_setlocale = 0;
-  my $orig = \&Gtk3::disable_setlocale;
-  *{Gtk3::disable_setlocale} = sub {
+  *{'Gtk3::disable_setlocale'} = sub {
     $disable_setlocale = 1;
-    $orig->(@_);
+    Glib::Object::Introspection->invoke (
+      $_GTK_BASENAME, undef, 'disable_setlocale', @_);
   };
 
   # These two already have overrides.
@@ -1509,7 +1509,6 @@ if ($^V ge v5.20.0) {
     };
   }
 
-  # These do not.
   foreach my $function (qw/init_with_args parse_args/) {
     *{'Gtk3::' . $function} = sub {
       if (!$disable_setlocale) {
diff --git a/t/00-init.t b/t/00-init.t
index 17a4ec4..375671a 100644
--- a/t/00-init.t
+++ b/t/00-init.t
@@ -19,12 +19,12 @@ unless (eval { Gtk3->import; 1 }) {
 
 plan tests => 2;
 
-SKIP: {
-  diag (sprintf 'Testing against gtk+ %d.%d.%d',
-        Gtk3::get_major_version (),
-        Gtk3::get_minor_version (),
-        Gtk3::get_micro_version ());
+diag (sprintf 'Testing against gtk+ %d.%d.%d',
+      Gtk3::get_major_version (),
+      Gtk3::get_minor_version (),
+      Gtk3::get_micro_version ());
 
+SKIP: {
   @ARGV = qw(--help --name gtk2perl --urgs tree);
   skip 'Gtk3::init_check failed, probably unable to open DISPLAY', 2
     unless Gtk3::init_check ();
@@ -35,3 +35,8 @@ SKIP: {
   # Gtk3::init().
   ok (defined eval 'use 5.8.0; 1');
 }
+
+# Ensure Gtk3::disable_setlocale () does not recurse forever, as it used to.
+{
+  Gtk3::disable_setlocale ();
+}


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