Re: How can I check if a GtkWidget exists?
- From: David NeÄas <yeti physics muni cz>
- To: Miroslav Rajcic <rajcic sokrates hr>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How can I check if a GtkWidget exists?
- Date: Fri, 20 Jul 2012 10:39:29 +0200
On Fri, Jul 20, 2012 at 10:15:54AM +0200, Miroslav Rajcic wrote:
Not sure, but perhaps GTK_IS_WIDGET(widget) macro would help.
If you have the pointer to a GObject instance and want to know whether
it is an instance of GtkWidget (including subclasses) then
GTK_IS_WIDGET() is the right thing to use.
But if you use this macro with a random pointer (e.g. one pointing to a
memory location where some GObject might be some time ago) do not expect
anything more useful than a CRITICAL error/crash.
To deal with objects that may or may not exist use one of the several
mechanisms (weak pointers/weak refs/destroy callbacks/...) for keeping
track of the object existence. And, generally, use these mechanisms to
avoid even the possibility of dangling pointers in your code.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]