Re: GLib-CRITICAL Source ID 35 was not found when attempting to remove it

On Wed, 16 Sep 2015 16:35:09 +0100
Chris Vine <chris cvine freeserve co uk> wrote:
On Wed, 16 Sep 2015 10:54:15 +0530
Lokesh Chakka <lvenkatakumarchakka gmail com> wrote:

i kept gtk_thread_enter / leave for experimental purpose.
Actually issue was happening irrespective of existence of
gtk_thread_enter / leave.

You are missing the point.  You must use gdk_threads_enter() and
gdk_threads_leave() both (i) where you already have them in main(),
and (ii) also around gtk_widget_queue_draw() in the callback.

However, gdk_threads_init(), gdk_threads_enter() and
gdk_threads_leave() are deprecated in GTK+3, and only work with X11
(not on windows). Instead, you should do what has been suggested and
send an event from the worker thread to the GTK+ main loop using
g_idle_add().  Then you do not need to bother with
gdk_threads_init(), gdk_threads_enter() or gdk_threads_leave() in
your program at all.  You will however need to call g_thread_init()
at the beginning of main() with glib < 2.32. glib >= 2.32 is thread
safe without g_thread_init() (which is a no-op).

By the way if you wish to continue this further please move to another
mailing list such as gtk-list or gtk-app-devel-list.  This list is
concerned with the development of GTK+, not with application


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