segfault in gtk_object_check_cast




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



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