On Sun, 2005-10-16 at 15:59, Michael Matthews wrote:
> Hi!
> 
> I am converting my program to use multiple threads: the primary
> thread for the GTK stuff, and the worker threads for all the
> time-consuming work that will be performed in the background.
> The GUI thread takes input from the user and copies it to a
> global, shared, synchronized data pool which the worker threads
> monitor. The workers, in turn, invoke GTK functions to write the
> results to some list/tree views.
> 
> The problem I have run into is that the list/tree views are not
> updating properly. They only show a portion of the data which
> has been written to their models. If I minimize the app window
> and then restore it, the missing data appears. What am I doing
> wrong, and what should I do to resolve it?

Are you wrapping all your setters in calls to gdk_threads_enter/leave?
For example:

    gdk_threads_enter();
    GtkTreeIter iter;
    gtk_list_store_append(model,&iter);
    gtk_list_store_set(model,&iter,MY_COLUMN,my_data,-1);
    gdk_threads_leave();

> I would have the GUI thread update the list/tree models, but the
> GUI thread spends most of its time sitting in gtk_main.

You will, of course, need to be sure you've done the right thing in your
main thread as well:

    gdk_threads_init();
    gdk_threads_enter();
    gtk_main();
    gdk_threads_leave();

-AME

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to