Segmentation fault with Gtk2::MozEmbed



The following script crash after the third click of the button, ie:
after creating, destroying and recreating a window with a Gtk2::MozEmbed

the segmentation fault happens on a mandrake 10.2, a 2006.0 and a Source
Mage install, so it's not specific to my setup.

BTW, on my system I need to have
LD_LIBRARY_PATH="/usr/lib/mozilla-firefox-1.0.6/"
for Gtk2::MozEmbed to work, and I haven't found a way to make it work at
runtime if this path was not in the library search path at when the
script started. (I tried using $ENV{LD_LIBRARY_PATH} and
@DynaLoader::dl_library_path), any ideas ?

Quentin.


#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 "-init";
use Gtk2::MozEmbed;
my $window;

my $w2=Gtk2::Window->new;
my $button=Gtk2::Button->new('Show/Hide');
$button->signal_connect(clicked => \&click);
$w2->add($button);
$w2->show_all;
Gtk2->main;

sub click
{       if ($window) {$window->destroy;$window=undef;return}
        $window=Gtk2::Window->new;
        $window->{embed}=my $embed = Gtk2::MozEmbed -> new();
        my $vbox=Gtk2::VBox->new;
        my $hbox = Gtk2::HBox->new;
        my $back=Gtk2::ToolButton->new_from_stock('gtk-go-back');
        my $forward=Gtk2::ToolButton->new_from_stock('gtk-go-forward');
        $hbox->pack_start($_,0,0,4) for $back,$forward;
        $vbox->pack_start($hbox,0,0,1);
        $vbox->add($embed);
        $window->add($vbox);
        $window->resize(400,500);
        $window->show_all;
        $back->signal_connect(clicked => sub { $embed->go_back });
        $forward->signal_connect(clicked => sub { $embed->go_forward });

        #$embed->load_url('http://www.google.com');
}





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