The following app has a GooCanvas, and has a button which will add a rect on canvas after clicked. It deadlocks while click on "Add" button. ################################################## #!/usr/bin/perl use strict; use threads; use threads::shared; use Glib qw/TRUE FALSE/; use Gtk2 qw/-init -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->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; } ################################################## Hotmail: Trusted email with powerful SPAM protection. Sign up now. |