From 1d6c7843caebdeac72f80ecb0f9807afc853affc Mon Sep 17 00:00:00 2001
From: Arthur Demchenkov <spinal.by@gmail.com>
Date: Sun, 14 Oct 2018 05:03:42 +0300
Subject: [PATCH 213/682] gobject/genums.c: fix flags validation

gint -> glong conversion causes flags to be invalid if the highest bit
is set.

Closes #1572
---
 gobject/genums.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gobject/genums.c b/gobject/genums.c
index 8212dd99d..aa27c6bb4 100644
--- a/gobject/genums.c
+++ b/gobject/genums.c
@@ -152,7 +152,10 @@ value_flags_enum_collect_value (GValue      *value,
 				GTypeCValue *collect_values,
 				guint        collect_flags)
 {
-  value->data[0].v_long = collect_values[0].v_int;
+  if (G_VALUE_HOLDS_ENUM (value))
+    value->data[0].v_long = collect_values[0].v_int;
+  else
+    value->data[0].v_ulong = (guint) collect_values[0].v_int;
 
   return NULL;
 }
-- 
2.19.1

