Re: Problem with GUI not (always) updating...
- From: Michael L Torrie <torriem chem byu edu>
- To: gtk-list gnome org
- Subject: Re: Problem with GUI not (always) updating...
- Date: Mon, 02 Apr 2007 09:42:04 -0600
On Mon, 2007-04-02 at 13:58 +0200, Matthias Scheer wrote:
> Hi all,
> I'm developing a computational tool with a nice GUI using GTK2+ and
> Glade3. The OS is Ubuntu 6.10 with Gnome UI. Now I have encountered some
> strange behaviour.
> The application essentially asks for alot of parameters for the user to
> enter, has a progress bar and a start, pause and exit button. When the
> users hits start, I'm spawning a new thread (using pthreads) and let the
> signal handler of start button return to the gtk_main() loop. This is
> required because the computation takes quite some time and the user
> should have the possibility to pause the program.
> Now I've run into some 'indeterministic' effects. In about half of the
> test runs, the GUI keeps accessible to the user, i.e. eyecandy on the
> button on mouse-over, and the program works normally. In the other half,
> the GUI freezes, but the computation finishes normally. Strangely, the
> program reacts on clicks on the GUI, i.e. it pauses, exits etc, but the
> GUI itself is frozen.
This is classic behavior when you use threads in GTK without following
the instructions for using GTK in a threaded way.
Does your thread interact with the gui at all? Are you following the
documentation for setting up GDK threading and locking any calls to gtk
from your thread? If you are calling gtk calls from your thread for the
purpose of updating the gui, consider calling the thread-safe g_idle_add
call from your thread and then having a callback (which would run in the
main GUI thread) do any gui calls for you.
> I'm running kernel 188.8.131.52 with the xenomai real-time patch.
> Any hints?
> Matthias Scheer
> gtk-list mailing list
> gtk-list gnome org
] [Thread Prev