On Mon, 06 Aug 2012 13:42:35 -0400, Colin Walters wrote: > This raises the question "what main context"? I'd suggest that GTK > should store the result of g_main_context_get_thread_default() when > gtk_init() is called. > > Also, how does the object slot get set? Add it to _constructed for > each object in GTK+? And then we need to patch the bindings to check > for it?
The idea was to have some flag in the class definition signaling that the objects of the class are 'context-sensitive', and gobject construction guts would assign the slot automatically using g_main_context_thread_default(). So no code would be needed inside gtk/ gdk/clutter, just one additional flag in class definition. > I'm thinking a cleaner solution is to just patch gtk+ like this: > > 1) Capture the context at gtk_init() time 2) Patch each finalize method > that calls thread-unsafe functions (e.g. > libX11) to use g_main_context_invoke (gtk_get_main_context (), > gdk_x11_cursor_real_finalize, > object) This is nice, much more lightweight, and does not use per-object slot. The only drawback is that it must be done manually in the whole gdk/gtk/ clutter. But it might not actually be that big drawback. > The thing to note here is that we don't need to bounce every > g_object_unref(), we just need to ensure the finalizers are run in the > default main context. Yep, thats exactly why I think that this should be done inside framework and not on the bindings level. pavel _______________________________________________ gtk-devel-list mailing list gtk-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-devel-list