Re: GtkListStore and Threads problems
- From: Lorena Salinas <lsalinas invap com ar>
- To: Owen Taylor <otaylor redhat com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkListStore and Threads problems
- Date: Tue, 14 Jun 2005 15:20:16 -0300
Hi,
This is what I do inside the worker_thread function
(create_and_start_worker_thread ()) every time I want to update the
model:
gdk_threads_enter(); /* get GTK thread lock */
gtk_list_store_set (GTK_LIST_STORE (host_model), &iter,
MYMODEL_COL_STATUS, STATUS_NORMAL,
-1);
gdk_threads_leave(); /* release GTK thread lock */
I don't know if the problem is because the model is sorted by that
column. I set this using : gtk_tree_view_column_set_sort_column_id
(column, MYMODEL_COL_STATUS) when I create the tree_view for that model
.
Regards,
Lorena
On Tue, 2005-06-14 at 14:58, Owen Taylor wrote:
On Tue, 2005-06-14 at 14:40 -0300, Lorena Salinas wrote:
Hi,
This is my app's main function:
int main (int argc, char **argv)
{
/* init threads */
g_thread_init(NULL);
gdk_threads_init();
/* init gtk */
gtk_init (&argc, &argv);
/* create the model and fill with data */
create_and_fill_model();
/* create the window with a tree_view and an icon_view */
create_window_and_views_for_model();
/* start the worker thread */
create_and_start_worker_thread ();
/* enter the GTK main loop */
gdk_threads_enter();
gtk_main();
gdk_threads_leave();
return 0;
}
I don't surround function calls in the main loop (eg: callbacks like row
changed)
because this will actually block the main thread.
I'd suggest reviewing
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Threads.html
in detail. Somewhere, you modifying the tree view without the GTK+/GDK
lock.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]