summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorJosé Alburquerque <jaalburqu@svn.gnome.org>2012-11-06 20:25:39 -0500
committerJosé Alburquerque <jaalburqu@svn.gnome.org>2012-11-06 20:28:03 -0500
commit5596d9f3ddca6942d632c85f1cbed475e0a766a8 (patch)
treee656807b5d6caba3d3ce495d03c705f2c722215e /glib
parent6925ecbd7614dff90bfab50bd153f53fe62dafea (diff)
downloadglibmm-5596d9f3ddca6942d632c85f1cbed475e0a766a8.tar.gz
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.
Diffstat (limited to 'glib')
-rw-r--r--glib/src/variant.ccg32
-rw-r--r--glib/src/variant.hg9
-rw-r--r--glib/src/variant_basictypes.cc.m44
3 files changed, 0 insertions, 45 deletions
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index e75a17e5..b7f4f520 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;
}
@@ -493,10 +469,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;
}
@@ -521,10 +493,6 @@ Variant<type_vec_string>::create_from_object_paths(const type_vec_string& data)
Variant<type_vec_string>(g_variant_new_objv(str_array, 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 2caa689c..7407d350 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -881,9 +881,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;
}
@@ -941,9 +938,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;
}
@@ -1033,9 +1027,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 1b54ac1a..ba79a204 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;
}