RE: Goo::Canvas deadlock on Gtk2::Gdk::Threads->enter



That works well, thanks!
But where are the documents of Glib::Idle? I can't find any perldoc about it.

> Subject: Re: Goo::Canvas deadlock on Gtk2::Gdk::Threads->enter
> From: mario kemper googlemail com
> To: jiandingzhe msn com
> CC: gtk-perl-list gnome org
> Date: Fri, 7 May 2010 14:04:09 +0200
>
> Does this help?
>
> sub on_add {
> Glib::Idle->add(sub{
> Gtk2::Gdk::Threads->enter;
> Goo::Canvas::Rect->new(
> $root,100,100,50,120
> );
> Gtk2::Gdk::Threads->leave;
> return FALSE;
> });
> }
>
>
> Regards
> Mario
>
> Am Freitag, den 07.05.2010, 07:07 +0000 schrieb Xi Yang:
> > #!/usr/bin/perl
> > use strict;
> >
> > use threads;
> > use threads::shared;
> >
> > use Glib qw/TRUE FALSE/;
> > use Gtk2 qw/-ini t -threads-init/;
> > use Goo::Canvas;
> >
> > Glib::Object->set_threadsafe(TRUE);
> >
> > # create window
> > my $win = Gtk2::Window->new;
> > $win->signal_connect( destroy => sub { Gtk2->main_quit; } );
> > $win->set_title('children rendering test');
> >
> > my $vbox = Gtk2::VBox->new( FALSE, 6 );
> > $win->add($vbox);
> >
> > # create Add button
> > my $hbox = Gtk2::HBox->new(FALSE,6);
> > $vbox->pack_start($hbox,FALSE,FALSE,0);
> >
> > my $but_add_node = Gtk2::Button->new('Add');
> > $hbox->pack_start($but_add_node,FALSE,FALSE,0);
> > $but_add_node->signal_connect('clicked'=>\&on_add);
> >
> > # create the c anvas
> > my $canvas = Goo::Canvas->new();
> > my $root = $canvas->get_root_item;
> > $canvas-& gt;set_size_request( 800, 500 );
> > $vbox->pack_start( $canvas, FALSE, FALSE, 0 );
> >
> > # enter mainloop
> > $win->show_all;
> > Gtk2->main;
> >
> > sub on_add {
> > Gtk2::Gdk::Threads->enter;
> > Goo::Canvas::Rect->new(
> > $root,100,100,50,120
> > );
> > Gtk2::Gdk::Threads->leave;
> > }
>


Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now.


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