Re: A bug in Gtk+?



On Wed, 2005-02-23 at 14:31 +0500, Zeeshan Ali wrote:
Hello,

On Wed, 23 Feb 2005 10:12:07 +0200, Olexiy Avramchenko
<olexiy ctech cn ua> wrote:
When you create main loop with NULL as context parameter, main loop gets
shared default context. Before you create your main loop, default
context was populated with functions from gtk/gdk.

The blocker is gdk_event_prepare (it just locks the global mutex), GLib
code call it because the event source is not removed by gtk_main_quit.

    Thanks. Got it :)
 
You may:
1. Create separate context (this looks like the best solution).
2. Use gdk_threads_leave() before your g_main_loop_run() call.
   I'll go for #1 i think.

Note that if you want to integrate your own callbacks with GTK+
GUI callbacks in the same thread (like repaint events), you need to do
1... you can only have one running contex per thread. And in fact, what
gtk_main() looks like is basically:

 gtk_threads_leave();
 g_main_loop_run();
 gtk_threads_enter();

So it's very much the "normal" way things work.

Regards,
                                                Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]