Re: Dealing with outstanding timeout callbacks
- From: Tim Müller <zen18864 zen co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: Dealing with outstanding timeout callbacks
- Date: Sun, 21 Nov 2004 10:54:28 +0000
On Sunday 21 November 2004 07:19, Braden McDaniel wrote:
I'm writing a Mozilla plug-in which uses g_timeout_add to add a timeout
callback to drive an animation in a widget. In my widget's destroy
function, I:
1. while (gtk_events_pending()) { gtk_main_iteration(); }
what's this for? Doing this in a destroy function doesn't look like a
particularly good idea to me.
2. Check my stored timeout_id (returned from g_timeout_add): if it is
nonzero, call g_source_remove.
Yet, there is still an outstanding timeout callback. It runs after my
widget is destroyed, and of course crashes. What do I need to do to run or
remove this callback before my widget is destroyed?
nothing really. g_source_remove() should be enough. Maybe you've done
timeout_id = g_timeout_add (...);
twice without further checks, and thus leaked the first id?
Cheers
-Tim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]