Re: List/TreeStore and threads



Thanks Kevin.

I know of the dispatcher but the problem is that I need to fill a TreeStore: the data is very complex and hard to send through a dispatcher.

Does anyone know if filing a store that is not bound to any TreeView would be ok (out of the main thread, I mean)? Is so, I could just swap the TreeView's store with the new one.

Thanks
yann

On 02/08/13 15:10, Kevin Brightwell wrote:
I'm not entirely sure of your problem, but I do know that GTK does not guarantee any thread safety for it's components. You should not be modifying the TreeView outside the UI thread. If this is how GTK manifests this problem, so be it. There is a Glib::Dispatcher() [1] [2] which would allow you to spawn the dispatcher in the UI thread, then push things from a worker thread and make sure the value gets updated on the UI.

I hope I'm actually helping the problem and not just being critical on style. :(

Cheers,

Kevin

[1] https://developer.gnome.org/glibmm/2.35/classGlib_1_1Dispatcher.html
[2] https://developer.gnome.org/gtkmm-tutorial/3.8/sec-using-glib-dispatcher.html.en



On Fri, Aug 2, 2013 at 8:51 AM, Yann Leydier <yann leydier info> wrote:
Hi,

my application fills some TreeStrores and ListStores at runtime but the data is read from large files and the computation of some values takes time. Therefore I put a progress bar in a splash window and fill the store in another thread.

The TreeView fills oddly: once the lines do not fit anymore on the display, the scollbar is not updated. I tried to add gdk_threads_entrer() and gdk_threads_leave() before and after the calls to XXXStore::append() but it did not change anything.

First question: are the stores really thread unsafe? I tend to consider them as non-UI classes, so TreeView should be the one handling the thread-safety…

Second question: how do I make sure I do not mess up with the thread safety when filling my stores?

Thanks a lot,
yann
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



--
Kevin Brightwell
BESc. and BSc. Candidate 2015
Western University www.westernu.ca
e. kevin brightwell2 gmail com c. 226.678.4927



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