[perl-Glib] Fix compilation on libglib < 2.26
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib] Fix compilation on libglib < 2.26
- Date: Tue, 22 Sep 2015 20:10:34 +0000 (UTC)
commit 5cece030118e2aacb772c98a258b1aaa2cbf1c8e
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date: Tue Sep 22 22:09:56 2015 +0200
Fix compilation on libglib < 2.26
It didn't have g_variant_is_floating yet.
GVariant.xs | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/GVariant.xs b/GVariant.xs
index 733ec7a..697422e 100644
--- a/GVariant.xs
+++ b/GVariant.xs
@@ -40,10 +40,15 @@ variant_to_sv (GVariant * variant, gboolean own)
if (own) {
#if GLIB_CHECK_VERSION (2, 30, 0)
g_variant_take_ref (variant);
-#else
+#elif GLIB_CHECK_VERSION (2, 26, 0)
if (g_variant_is_floating (variant)) {
g_variant_ref_sink (variant);
}
+#else
+ /* In this case, we have no way of finding out whether the
+ * variant has a floating ref, so we just always ref_sink even
+ * if this might cause a leak in some cases. */
+ g_variant_ref_sink (variant);
#endif
} else {
g_variant_ref (variant);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]