Subject: | GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed at /usr/local/share/perl/5.8.8/POE/Loop/Glib.pm line 176. |
Hi,
I got the following error/warning messages while using
the Glib POE loop.
A script I was playing around with (attached: "poe-gtk.pl")
(that sets and removes alarms frequently) revealed the
error.
Use of uninitialized value in subroutine entry at
/usr/local/share/perl/5.8.8/POE/Loop/Glib.pm line 176.
GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed at
/usr/local/share/perl/5.8.8/POE/Loop/Glib.pm line 176.
Here's a patch (Glib.pm.patch) for a fix to Glib.pm
that seems to fix it; but could it be that
I am doing something wrong? The script
is just some code I was using to try out
double-click/single-click detection.
Version of POE::Loop::Glib used: 0.0033
Here's some information about my environment:
OS: Linux, 2.6.24-1-amd64 #1 SMP Fri Apr 18 23:08:22 UTC 2008 x86_64 Perl:
This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
GNU/Linux
Debian, lenny/sid
Installed Packages:
libglib-perl 1:1.181-1
libglib1.2 1.2.10-17
libglib1.2-dev 1.2.10-19
libglib1.2ldbl 1.2.10-19
libglib2.0-0 2.16.1-2
libglib2.0-cil 2.12.0-2
libglib2.0-dev 2.16.1-2
libglibmm-2.4-1c2a 2.16.2-1
libglibmm-2.4-dev 2.16.2-1
libgtk1.2 1.2.10-18.1
libgtk1.2-common 1.2.10-18.1
libgtk2-gladexml-perl 1.006-1
libgtk2-perl 1:1.181-1
libgtk2.0-0 2.12.9-2
libgtk2.0-0-dbg 2.12.9-2
libgtk2.0-bin 2.12.9-2
libgtk2.0-cil 2.12.0-2
libgtk2.0-common 2.12.9-2
libgtk2.0-dev 2.12.9-2
libgtkglext1 1.2.0-1
libgtkhtml2-0 2.11.1-2
libgtkhtml3.14-19 3.18.1-1
libgtkhtml3.8-15 3.12.3-3
libgtkimageview0 1.6.1-2
libgtkmm-2.4-1c2a 1:2.12.7-1
libgtkmm-2.4-dev 1:2.12.7-1
libgtksourceview-common 1.8.5-1
libgtksourceview1.0-0 1.8.5-1
libgtksourceview2.0-0 2.2.1-1
libgtksourceview2.0-common 2.2.1-1
libgtkspell0 2.0.10-4
Subject: | Glib.pm.patch |
--- /usr/local/share/perl/5.8.8/POE/Loop/Glib.pm 2008-05-06 20:24:45.000000000 +0900
+++ Glib.pm 2008-05-06 20:24:35.000000000 +0900
@@ -171,11 +171,11 @@
}
$self->_data_ev_dispatch_due();
$self->_test_if_kernel_is_idle();
- Glib::Source->remove($_watcher_timer) if defined $_watcher_timer;
+ Glib::Source->remove($_watcher_timer);
undef $_watcher_timer;
# Register the next timeout if there are events left.
if ($self->get_event_count()) {
$_watcher_timer = Glib::Idle->add(\&_loop_resume_timer);
Subject: | poe-gtk.pl |
#!/usr/bin/perl
use warnings;
use strict;
use Glib;
use Gtk2 -init;
use POE::Kernel { loop => "Glib" };
use POE::Session;
use Data::Dumper;
use Time::HiRes;
POE::Session->create(
inline_states => {
_start => \&ui_start,
evt_pressed => \&handle_pressed,
evt_single_click => sub {
print "single click!\n";
},
evt_double_click => sub {
print "double click!\n";
}
}
);
$poe_kernel->run();
sub handle_pressed {
my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ];
my $event = $_[ARG1]->[1];
$kernel->alarm_remove(delete $heap->{single_click_alarm});
if ($event->type eq 'button-press') {
$heap->{single_click_alarm} = $kernel->delay_set(evt_single_click => 0.2 );
} elsif ($event->type eq '2button-press') {
$kernel->yield('evt_double_click');
}
}
sub ui_start {
my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ];
$heap->{main_window} = Gtk2::Window->new("toplevel");
$kernel->signal_ui_destroy( $heap->{main_window} );
my $label = Gtk2::Label->new("click or double-click?");
my $evt_box = Gtk2::EventBox->new;
$heap->{main_window}->add($evt_box);
$evt_box->add($label);
$evt_box->show;
$label->show;
$evt_box->signal_connect( button_press_event => $session->callback("evt_pressed") );
$heap->{main_window}->show_all();
}