From: gnome-perl (bugzilla.gnome.o. <bug...@gn...> - 2010-11-25 20:55:57
|
https://bugzilla.gnome.org/show_bug.cgi?id=635809 gnome-perl | Glib | unspecified Summary: ParamSpec value_validate() on non ref counted boxed Classification: Bindings Product: gnome-perl Version: unspecified OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: Glib AssignedTo: gtk...@li... ReportedBy: us...@zi... QAContact: gtk...@li... GNOME target: --- GNOME version: --- Created an attachment (id=175274) View: https://bugzilla.gnome.org/attachment.cgi?id=175274 Review: https://bugzilla.gnome.org/review?bug=635809&attachment=175274 patch I think the code I made for value_validate() is no good on non reference counted boxed objects like GdkRectangle. In the 1.220 gperl_value_from_sv() copies to the local GValue, gperl_sv_from_value() makes a pointer into there, ie. doesn't copy), but then the memory is gone by g_value_unset of that local GValue. In the cvs head it's slightly better. gperl_value_from_sv() makes only a pointer to the incoming SV's memory, not a copy, gperl_sv_from_value() too makes a pointer not a copy, so you end up with an alias of the incoming SV. Which is ok so long as you don't naively discard that original SV. I'm looking at the change below to give back the input SV if value_validate() says it's ok already, and to copy out the GValue if it says it was changed. This would be for both 1.220 and the cvs head. The only thing I'm slightly unsure is whether setting the GValue to point into the original SV is right. Is g_param_value_validate() expected to set in a new block of memory if it makes a change, or will it modify the content in-place? I don't suppose anyone has every actually created a paramspec subtype taking a GdkRectangle or similar and mangled in value_validate(). -- Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. |