Override of Gtk3::Application->new



Dear Gtk3 Maintainers,

I suggest to add the following override to the Gtk3 Perl module:

sub Gtk3::Application::new {
        my ($class, $app_id, $flags) = @_;
        print "flags \n";
        Glib::Object::Introspection->invoke (
    $_GTK_BASENAME, 'Application', 'new', my $app, $app_id, $flags);
        return $app;
}


Explantation:
If you call "my $app = Gtk3::Application->new('app.id','flags-none');",
I get an segmentation fault error (perhaps someone can confirm the
bug?). Creating a Gtk Application is important for a Application Window!
By contrats the command "Gtk3::Application::new($app, 'app.id',
'flags-none')" works like a charme. For a beginner this is a big source
of errors. With the override above also the more perlish command "my
$app = Gtk3::Application->new('app.id','flags-none');" works well.

Here a little example (translated from the python beginners tutorial):

#! /usr/bin/perl

use strict;
use warnings;
use utf8;
use Gtk3 -init;
use Glib ('TRUE','FALSE');


# this works at the moment
Gtk3::Application::new(my $app,'app.pp','flags-none');

# this causes on my machine a segmentation fault error
# my $app = Gtk3::Application->new('app.pp','flags-none');
my $window = Gtk3::Window->new();
$window->set_application($app);
$window->set_title('Welcome to GNOME');
$window->signal_connect('delete-event'=>sub {Gtk3->main_quit()});

$window->show_all();
Gtk3->main;

Please let me know, whether this patch submission was submitted in the
right way? I am very inexperiments with this!

Best regards,
Max



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