Re: sleeping with GTK



Henri Torgemane <henrit yahoo-inc com> writes:
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);

(assuming you mean g_timeout_add)

  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?


That code should work fine, I think.

Havoc




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