[416] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] segfault in gtk_object_check_cast

daemon@ATHENA.MIT.EDU (Tim Janik)
Tue Jul 1 02:17:26 1997

From: Tim Janik <timj@psynet.net>
Date: Tue, 1 Jul 1997 08:16:56 +0200 (CEST)
To: Gtk+ mailing list <gtk-list@redhat.com>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


hi folks,

gtk_object_check_cast() is used to validate different types of object casts.
as this function checks for the validity of a cast, i would like it to not
segfault if invoked with an invalid object.

the line
< if (obj && !gtk_type_is_a (obj->klass->type, cast_type))
from gtkobject.c segfaulted for me several times (yep i made an invalid
cast, but that is another issue) because obj->klass didn't get checked
to be !=NULL.
(i came accross this with a GTK_WIDGET_DRAWABLE() on a widget that had
been freed already - ops..).

so i'd like this line to read something like
> if (obj && obj->klass && !gtk_type_is_a (obj->klass->type, cast_type))

or a better approach might be to issue a warning in this case...


---
ciaoTJ

--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post