how to tell if a widget is still "alive" ?
- From: Gregory Hosler <ghosler redhat com>
- To: GTK developer list <gtk-app-devel-list gnome org>
- Subject: how to tell if a widget is still "alive" ?
- Date: Thu, 17 Jun 2010 09:07:46 +0800
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I have an application where I'm making use of animated gifs on a GtkTextBuffer.
I set a timer (g_timeout_add()) to remove the animated character after a small
period of time (10 secs in this case).
The argument to the timer callback includes a pointer to the text buffer
GtkTextChildAnchor in front of where I inserted my animation. The idea is that
inside the timeout, I insert a static copy of the gif, and do a
gtk_text_buffer_delete() of the iter's before and after the animation.
This works about 99.999% of the time.
In some rare circumstances, by the time that the timer callback is called, the
GtkTextChildAnchor has been deleted.
To guard against this, I tested the GtkTextChildAnchor with
GTK_IS_TEXT_CHILD_ANCHOR(), but on occassion, I will get a segfault on the
GTK_IS_TEXT_CHILD_ANCHOR() (the address of the GtkTextChildAnchor is still a
valid address).
I'm thinking that the GtkTextChildAnchor has been deleted, the memory used for
something else, and the GTK_IS_TEXT_CHILD_ANCHOR() is seg faulting as a result.
Question: how might I avoid this seg fault situation ? Will "GTK_IS_WIDGET()"
help to determine if the GtkTextChildAnchor is still alive before testing it
with GTK_IS_TEXT_CHILD_ANCHOR() ? or is there a better way of doing this ?
All the best,
- -Greg
- --
+---------------------------------------------------------------------+
Please also check the log file at "/dev/null" for additional information.
(from /var/log/Xorg.setup.log)
| Greg Hosler ghosler redhat com |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkwZdWAACgkQ404fl/0CV/SYRwCg6JXmt0AwKcwHA2iVNG9QdxlP
EjEAnitvkFaBGtMQLHwhX2g5W1jPWN40
=Bs+R
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]