threads and trayicon error
- From: anguila <anguila gmail com>
- To: "gtk-perl-list gnome org List" <gtk-perl-list gnome org>
- Subject: threads and trayicon error
- Date: Mon, 29 Sep 2008 23:15:00 +0200
I'm writing a code that check if there is any news my universiti website. And for that I use 2 scripts. The first one (cvNews.pl) check if there is any new and if it finds show a dialog with that info. and if not, return error.
The other script is the trayicon applet. If I can get access into the site, it shows the "online-icon" but if I can't connect or I'm not connected to any network, shows the "offline-icon".
I have a funtion that update the state of the image in the trayicon, that use 2 threads. This function works, and does that supposed to do, but after some time the trayicon image doesn't show very well... the image that it shows is only some lines about that image, the image isn't complete.
I use 2 threads, the first one, execute the cvnews.pl to get the news, and the second wait $wait_time_error (the time acces to get the info from the web) to join the first thread for update the trayicon online or offline.
(...)
my $pic = Gtk2::Image->new_from_file($logo);
my $eventbox = Gtk2::EventBox->new;
$eventbox->add($pic);
my $icon= Gtk2::TrayIcon->new('trayicon');
$icon->add($eventbox);
$icon->signal_connect ('button-release-event'=> \&click);
(...)
my $wait_time_error=10;
sub update_ico {
my $avisar=shift;
my $thread_ico = threads->new(sub {
if ($avisar) {
open (IN,"perl $dir/cvNews.pl -avisar 2>&1 |");
}
else {
open (IN,"perl $dir/cvNews.pl 2>&1 |");
}
foreach (<IN>){
if ($_ =~/Error/){
1;
}
}
close IN;
0;
});
my $thread_idle= threads->new(sub {
sleep($wait_time_error); # Temps d'espera a que cvNews retorni algo i poder aixi recuperar el thread
my $err=$thread_ico->join(); # ja que si el recuperava inmediatament després és com si no executes cap thread.
if ($err){
$pic->set_from_file($logo_off);
# print "Logo off!\n";
}
else {
# print "Logo on!\n";
$pic->set_from_file($logo);
}
1;
});
return 1;
}
Any idea what is happening? Why it works and after crash? Sometimes return those errors... sometimes no..:
Buscant novetats...!
Buscant novetats...!
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed during global destruction.
Gtk-CRITICAL **: gtk_container_foreach: assertion `GTK_IS_CONTAINER (container)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_set_qdata: assertion `G_IS_OBJECT (object)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed during global destruction.
GLib-GObject-WARNING **: instance with invalid (NULL) class pointer during global destruction.
GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during global destruction.
GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed during global destruction.
GLib-GObject-WARNING **: instance with invalid (NULL) class pointer during global destruction.
GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during global destruction.
GLib-GObject-WARNING **: instance with invalid (NULL) class pointer during global destruction.
GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed during global destruction.
Scalars leaked: -1
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed at ./AppletcvNews.pl line 105.
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed at ./AppletcvNews.pl line 106.
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed at ./AppletcvNews.pl line 106.
GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed at ./AppletcvNews.pl line 106.
Segmentation fault
Thanks!
David.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]