sleeping with GTK



Hello,

I'm using the following code to wait x ms in my code, while still
getting GTK events processed:

static gboolean
gtk_wait_timeout (gpointer data)
{
  gtk_main_quit ();
  return FALSE;
}

static void
gtk_wait (gint ms)
{
  g_idle_add (ms, gtk_wait_timeout);
  gtk_main ();
}

My question is, Is this bad for any reason?
I got a core dump report that points to the gtk_main() call, with 4 more
stack entries above, 3 belonging to GTK but that I can't resolve (wrong
library version, probably) and one completely bogus.
Is there any known bug/reason that could explain this?
Is recursive calling of gtk_main really safe, or are there conditions I
should know and avoid?
Similarly, is it ok to call gtk_main_quit from a timeout handler, or is
there a "right" moment/place to do it?


Thanks,
Henri






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