Re: GtkListStore and Threads problems
- From: Lorena Salinas <lsalinas invap com ar>
- To: Peter Bloomfield <peterbloomfield bellsouth net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GtkListStore and Threads problems
- Date: Wed, 15 Jun 2005 11:11:53 -0300
Here is part of the function...
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (my_model),
&iter);
while (valid) {
gtk_tree_model_get (GTK_TREE_MODEL (my_model), &iter,
MYMODEL_COL_STATUS, &status,
-1);
/* do some long calculations.... */
gdk_threads_enter(); /* get GTK thread lock */
gtk_list_store_set (GTK_LIST_STORE (my_model), &iter,
MYMODEL_COL_STATUS,STATUS_NORMAL,
-1);
gdk_threads_leave(); /* release GTK thread lock */
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (my_model), &iter);
}
This is the only place where I update the model...
Is it valid to assume that iter is the same, that it hasn't changed?
Regards,
Lorena
On Tue, 2005-06-14 at 16:01, Peter Bloomfield wrote:
On 06/14/2005 02:20:16 PM Tue, Lorena Salinas wrote:
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
*/
This may not be the cause of your current problem, but in this
code you can't be sure that the GtkTreeIter is valid, because the
lock has been dropped and reacquired. Validating and using an
iter while holding the lock is safer.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]