[glibmm/glibmm-2-34] VariantType: Correct the referencing in the create*() methods.
- From: Josà Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-34] VariantType: Correct the referencing in the create*() methods.
- Date: Tue, 20 Nov 2012 22:07:05 +0000 (UTC)
commit 2f305fc3382859ede923f17c377b143a9d12f311
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Tue Nov 20 16:50:29 2012 -0500
VariantType: Correct the referencing in the create*() methods.
* tools/m4/convert_glib.m4: Correct the 'GVarianType*' to VariantType
conversion to not take an extra reference when wrapping the
GVariantType in the VariantType.
* glib/src/variant.hg:
* glib/src/varianttype.hg: Also move the 'const GVariantType'
conversion from the global glib convert file (above) to these local
files because it takes an extra reference of the GVariantType.
Bug #688440 (Andrew Potter).
ChangeLog | 14 ++++++++++++++
glib/src/variant.hg | 4 ++++
glib/src/varianttype.hg | 3 +++
tools/m4/convert_glib.m4 | 3 +--
4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index acf6741..d950b39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2012-11-20 Josà Alburquerque <jaalburquerque gmail com>
+
+ VariantType: Correct the referencing in the create*() methods.
+
+ * tools/m4/convert_glib.m4: Correct the 'GVarianType*' to VariantType
+ conversion to not take an extra reference when wrapping the
+ GVariantType in the VariantType.
+ * glib/src/variant.hg:
+ * glib/src/varianttype.hg: Also move the 'const GVariantType'
+ conversion from the global glib convert file (above) to these local
+ files because it takes an extra reference of the GVariantType.
+
+ Bug #688440 (Andrew Potter).
+
2012-11-13 Josà Alburquerque <jaalburquerque gmail com>
giomm.h: Re-add an accidentally removed include.
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index ce3307c..5232010 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -97,7 +97,11 @@ public:
*/
void init(const GVariant* cobject, bool take_a_reference = false);
+// It's necessary to take an extra reference of the 'const GVariantType*'
+// returned by g_variant_get_type() because it doesn't do that already.
+#m4 _CONVERSION(`const GVariantType*',`VariantType',`Glib::wrap(const_cast<GVariantType*>($3), true)')
_WRAP_METHOD(VariantType get_type() const, g_variant_get_type)
+
_WRAP_METHOD(std::string get_type_string() const, g_variant_get_type_string)
_WRAP_METHOD(bool is_floating() const, g_variant_is_floating)
_WRAP_METHOD(bool is_of_type(const VariantType& type) const, g_variant_is_of_type)
diff --git a/glib/src/varianttype.hg b/glib/src/varianttype.hg
index c9e6a0e..e5e8973 100644
--- a/glib/src/varianttype.hg
+++ b/glib/src/varianttype.hg
@@ -140,6 +140,9 @@ public:
_WRAP_METHOD(bool is_subtype_of(const VariantType& supertype) const, g_variant_type_is_subtype_of)
+// It's necessary to take an extra reference of the 'const GVariantType*'
+// returned by g_variant_type_element() because it doesn't do that already.
+#m4 _CONVERSION(`const GVariantType*',`VariantType',`Glib::wrap(const_cast<GVariantType*>($3), true)')
_WRAP_METHOD(VariantType element() const, g_variant_type_element)
_WRAP_METHOD(VariantType first() const, g_variant_type_first)
_WRAP_METHOD(VariantType next () const, g_variant_type_next)
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index 9ac8eeb..5e36245 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -155,8 +155,7 @@ _CONVERSION(`const VariantContainerBase&',`GVariant*',`const_cast<GVariant*>(($3
dnl VariantType
_CONVERSION(`const VariantType&',`const GVariantType*',`($3).gobj()')
_CONVERSION(`const Glib::VariantType&',`const GVariantType*',`($3).gobj()')
-_CONVERSION(`const GVariantType*',`VariantType',`Glib::wrap(const_cast<GVariantType*>($3), true)')
-_CONVERSION(`GVariantType*',`VariantType',`Glib::wrap(($3), true)')
+_CONVERSION(`GVariantType*',`VariantType',`Glib::wrap($3)')
dnl Miscellaneous
_CONVERSION(`gint64&',`gint64*',`&($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]