[perl-Glib] Don't copy boxed objects in gperl_value_from_sv
- From: Torsten Schönfeld <tsch src gnome org>
- To: svn-commits-list gnome org
- Subject: [perl-Glib] Don't copy boxed objects in gperl_value_from_sv
- Date: Sun, 17 May 2009 10:48:00 -0400 (EDT)
commit 6527c020d30339436b644f53be7766ddac0146a0
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Sun May 17 16:47:20 2009 +0200
Don't copy boxed objects in gperl_value_from_sv
When converting an SV to a GBoxed-typed GValue, use g_value_set_static_boxed
instead of g_value_set_boxed so that the original GBoxed is stored, not a copy.
---
GValue.xs | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/GValue.xs b/GValue.xs
index 5c73b52..adfd294 100644
--- a/GValue.xs
+++ b/GValue.xs
@@ -123,12 +123,16 @@ gperl_value_from_sv (GValue * value,
break;
case G_TYPE_BOXED:
/* SVs need special treatment! */
- if (G_VALUE_HOLDS (value, GPERL_TYPE_SV))
+ if (G_VALUE_HOLDS (value, GPERL_TYPE_SV)) {
g_value_set_boxed (value,
gperl_sv_is_defined (sv)
? sv : NULL);
- else
- g_value_set_boxed (value, gperl_get_boxed_check (sv, G_VALUE_TYPE(value)));
+ } else {
+ g_value_set_static_boxed (
+ value,
+ gperl_get_boxed_check (
+ sv, G_VALUE_TYPE(value)));
+ }
break;
case G_TYPE_PARAM:
g_value_set_param(value, SvGParamSpec (sv));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]