Re: About Treeview update with thread
- From: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
- To: åçå <ruibotang gmail com>
- Cc: muppet <scott asofyet org>, gtk-perl-list gnome org
- Subject: Re: About Treeview update with thread
- Date: Wed, 13 May 2009 17:40:35 +0200
2009/5/13 åçå
<ruibotang gmail com>
hi, muppet,
Â
Many thanksÂfor your suggestion,Âsorry for late to response.Â
Â
I have tried the three methods you mentioned (gdk lock; Glib::Idle and a variant technique), and found an alternative solution for my issue. But there still exist other unsolved issues, as below
Â
For the gdk lock method, I have used Gtk2::Gdk::Threads->enter and Gtk2::Gdk::Threads->leave in my background thread, it seem that it can update all the widgets(like button, labes) correctly excepte the Gtk2::TreeModel(I used a Gtk2::ListStore actually). when i use the Gtk2::TreeModel->set() method, it will fail and says "Usage: Gtk2::TreeModel->set($liststore, $iter, $col.....)" , and then the exit.ÂÂÂI checked my code and found that I have a column with type Glib::Scalar in my treemodel, in this column i assign a pointer to an new constructed object ( the object is not a subclass of Glib::Object, and have not decleared as shared), I do not know ifÂthe fail have relationship with this object?
Â
From what I understood perl has a lot of troubles with threads and objects (blessed references). I recall when threads where first available in Perl that sharing blessed references will loose the blessing. The data is passed intact to the other thread but the blessing is lost, this makes calling methods on objects useless. I'm not sure if this is the issue with your program but your should keep it in mind.
Â
CPAN seems to be having a few modules that should help passing blessed instances between threads.
--
Emmanuel Rodriguez
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]