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



On 09/15/2015 09:03 PM, Lokesh Chakka wrote:

> static void *thread_function( void *parameter )
> {
>      const int seconds = 1000;
>
>      for( i=0; i<seconds; i++ )
>      {
>          gtk_widget_queue_draw( (GtkWidget*)darea );
>          sleep(1);
>      }
> }

It's not okay to touch Gtk+ widgets from a thread other than the main thread owning the gtk main loop.

Try using g_timeout_add() to get a callback within the mainloop and do your gtk_widget_queue_draw() from there.

-- Christian



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