After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663881 - Add support for GString
Add support for GString
Status: RESOLVED FIXED
Product: gnome-perl
Classification: Bindings
Component: Glib
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk2-perl-bugs
gtk2-perl-bugs
Depends on:
Blocks:
 
 
Reported: 2011-11-11 19:49 UTC by Emmanuel Rodriguez
Modified: 2011-11-13 14:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for GString (1.87 KB, patch)
2011-11-11 19:49 UTC, Emmanuel Rodriguez
committed Details | Review

Description Emmanuel Rodriguez 2011-11-11 19:49:15 UTC
Created attachment 201252 [details] [review]
Patch for GString

WebKit returns a GString which is a glib type and this causes some problems in Gtk3::WebKit.

I propose a patch that can fix the problem.
Comment 1 Torsten Schoenfeld 2011-11-13 14:49:49 UTC
Review of attachment 201252 [details] [review]:

I pushed the change with the change described below.  Thank you for the patch!

[Normally, we don't add features like this in a stable branch (which master currently is), but I figured it's fine this case.]

::: GBoxed.xs
@@ +689,3 @@
+
+	ptr = SvPV(sv, len);
+	gstr = g_string_new_len ( ptr, len );

The unwrap functions are not supposed to allocate new memory.  In the default boxed handler, unwrap simply returns the stored pointer to the object.  But that of course doesn't work for types which we convert to and from native types, like in the GString case.  The usual pattern then is to use gperl_alloc_temp to allocate memory that will be freed at the end of the current lexical scope.