Re: Opening dialogs outside the Gtk thread?
- From: Matthias Kaeppler <matthias finitestate org>
- To: gtk-list gnome org
- Subject: Re: Opening dialogs outside the Gtk thread?
- Date: Fri, 28 Oct 2005 10:21:29 +0200
Tim Janik wrote:
you can use gtk functions from any thread, as long as you take care to
acquire the gtk lock around any gtk functions:
GDK_THREADS_ENTER ();
fire up dialog here.
GDK_THREADS_LEAVE ();
Yep, I could do that. However I was told that the cleaner approach is to
use a dispatcher (Glib::Dispatcher) and make sure that the GUI is only
modified in the Gtk main thread. I also noticed strange behavior when
using these functions when I didn't wrapped each and every call in them
(making my code extremely ugly since I quite often need to make GUI
calls from other threads).
Besides, this lock/unlock thing doesn't seem to be the whole story. For
example, my program will only lock up when I create and show a modal
dialog inside the second thread, while the dialogs I use to display
transfer progress (which were created--but not shown!!--in the main
thread) never crash my program when showing/hiding them! That just
doesn't make sense.
Since Nautilus, as I pointed out, also doesn't seem to suffer from this
inter-thread GUI problem, I am sure I am missing something. I thought
maybe someone here knows since I was pretty sure that the Nautilus
developers read this list.
Regards,
Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]