Re: Using gtk_idle_add in a GNOME app, plus a little




On Mon, 21 Dec 1998, James Smith wrote:
> 
> static void
> idle_cb(gpsui_app *data) {

Wrong signature. You have to return a gint; if the return value is FALSE,
the idle is not called again; if it's TRUE, then it is. So you're probably
getting weird random behavior since the void return will leave garbage 
for a return value.

>     gtk_idle_add(idle_cb, data);

You should just return true, to keep the idle in place; and add it only
once, from outside the function. This probably causes breakage since there
will be a list of idles that Gtk is iterating over, and you insert into
the list during the iteration... not such a good idea. If you don't remove
the idle each time, you'll end up with a sort of sick infinite list of
identical idle functions. Even if you do remove it you might confuse Gtk's
iteration over the list.

Havoc




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