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

Re: segv on mistaken bless



Kevin Ryde wrote:

> It'd be nice if the code noticed that, but I couldn't tell if it'd be
> the signal_emit xsub or gperl_get_object_check which might check for a
> missing mg_find.  Do some uses of gperl_get_object_check expect to get
> back NULL for undef?

No, I think gperl_get_object_check is meant to either croak or return a
valid object.  So what about the attached patch?

-- 
Bye,
-Torsten
Index: GObject.xs
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GObject.xs,v
retrieving revision 1.74
diff -u -d -p -r1.74 GObject.xs
--- GObject.xs	8 Jan 2008 05:58:56 -0000	1.74
+++ GObject.xs	1 Jun 2008 12:48:24 -0000
@@ -824,6 +824,10 @@ gperl_get_object_check (SV * sv,
 		croak ("%s is not of type %s",
 		       gperl_format_variable_for_output (sv),
 		       package);
+	if (!mg_find (SvRV (sv), PERL_MAGIC_ext))
+		croak ("%s is not a proper Glib::Object "
+		       "(it doesn't contain magic)",
+		       gperl_format_variable_for_output (sv));
 
 	return gperl_get_object (sv);
 }


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