[glibmm/glibmm-2-34] Variant: Don't refsink variants created using the custom cast ctor.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-34] Variant: Don't refsink variants created using the custom cast ctor.
- Date: Wed, 7 Nov 2012 08:20:20 +0000 (UTC)
commit 85d18281ca261554db957f94f7d0742603759214
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Tue Nov 6 20:25:39 2012 -0500
Variant: Don't refsink variants created using the custom cast ctor.
* glib/src/variant.ccg:
* glib/src/variant.hg:
* glib/src/variant_basictypes.cc.m4: Remove the call to
g_variant_ref_sink() in the create() methods of the variant types that
use the custom cast constructor to wrap the newly created C object
because the custom cast constructor already refsinks the object if
necessary.
ChangeLog | 12 ++++++++++++
glib/src/variant.ccg | 28 ----------------------------
glib/src/variant.hg | 9 ---------
glib/src/variant_basictypes.cc.m4 | 4 ----
4 files changed, 12 insertions(+), 41 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a159538..aad2e0a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-11-06 Josà Alburquerque <jaalburquerque gmail com>
+
+ Variant: Don't refsink variants created using the custom cast ctor.
+
+ * glib/src/variant.ccg:
+ * glib/src/variant.hg:
+ * glib/src/variant_basictypes.cc.m4: Remove the call to
+ g_variant_ref_sink() in the create() methods of the variant types that
+ use the custom cast constructor to wrap the newly created C object
+ because the custom cast constructor already refsinks the object if
+ necessary.
+
2.34.1:
2012-11-04 Murray Cumming <murrayc murrayc com>
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index ded44d5..ed7db2a 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -112,11 +112,7 @@ VariantContainerBase::create_tuple(const std::vector<VariantBase>& children)
VariantContainerBase result = VariantContainerBase(g_variant_new_tuple(
var_array, children.size()));
-
- g_variant_ref_sink(result.gobj());
-
delete[] var_array;
-
return result;
}
@@ -136,12 +132,7 @@ VariantContainerBase::create_maybe(const VariantType& child_type,
{
GVariant* g_variant = g_variant_new_maybe(child_type.gobj(),
const_cast<GVariant*>(child.gobj()));
-
VariantContainerBase result = VariantContainerBase(g_variant);
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -221,10 +212,6 @@ const VariantType& Variant<VariantBase>::variant_type()
Variant<VariantBase> Variant<VariantBase>::create(const VariantBase& data)
{
Variant<VariantBase> result = Variant<VariantBase>(g_variant_new_variant(const_cast<GVariant*>(data.gobj())));
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -256,10 +243,6 @@ Variant<Glib::ustring>::create(const Glib::ustring& data)
{
Variant<Glib::ustring> result =
Variant<Glib::ustring>(g_variant_new_string(data.c_str()));
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -314,10 +297,6 @@ Variant<std::string>::create(const std::string& data)
{
Variant<std::string> result =
Variant<std::string>(g_variant_new_bytestring(data.c_str()));
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -403,9 +382,6 @@ Variant<type_vec_ustring>::create(const type_vec_ustring& data)
Variant<type_vec_ustring>(g_variant_new(
array_variant_type.get_string().c_str(), builder));
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -492,10 +468,6 @@ Variant<type_vec_string>::create(const type_vec_string& data)
data.size()));
g_strfreev(str_array);
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 97f8e71..ce3307c 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -869,9 +869,6 @@ Variant< std::pair<K, V> >::create(const std::pair<K, V>& data)
Variant< std::pair<K, V> > result = Variant< std::pair<K, V> >(
g_variant_new_dict_entry(key.gobj(), value.gobj()));
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -929,9 +926,6 @@ Variant< std::vector<T> >::create(const std::vector<T>& data)
Variant< std::vector<T> >(g_variant_new(
reinterpret_cast<gchar*>(array_variant_type.gobj()), builder));
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
@@ -1021,9 +1015,6 @@ Variant< std::map<K, V> >::create(const std::map<K, V>& data)
Variant< std::map<K, V> > result = Variant< std::map<K, V> >(g_variant_new(
reinterpret_cast<gchar*>(array_variant_type.gobj()), builder));
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
diff --git a/glib/src/variant_basictypes.cc.m4 b/glib/src/variant_basictypes.cc.m4
index 1b54ac1..ba79a20 100644
--- a/glib/src/variant_basictypes.cc.m4
+++ b/glib/src/variant_basictypes.cc.m4
@@ -45,10 +45,6 @@ const VariantType& Variant<$1>::variant_type()
Variant<$1> Variant<$1>::create($1 data)
{
Variant<$1> result = Variant<$1>(g_variant_new_$3(data));
-
- // Remove the floating reference (since it is newly created).
- g_variant_ref_sink(result.gobj());
-
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]