[json-glib] Only seal arrays and objects when a parser is immutable



commit 0cb1db37f8a1edf95f8d14c8868091804e54e4c3
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 13 09:10:59 2017 +0000

    Only seal arrays and objects when a parser is immutable
    
    We seal nodes conditionally on the :immutable property, but we are
    sealing their contents unconditionally.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=779970

 json-glib/json-parser.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c
index 655f2e2..6312cf8 100644
--- a/json-glib/json-parser.c
+++ b/json-glib/json-parser.c
@@ -610,7 +610,8 @@ json_parse_array (JsonParser   *parser,
 array_done:
   json_scanner_get_next_token (scanner);
 
-  json_array_seal (array);
+  if (priv->is_immutable)
+    json_array_seal (array);
 
   json_node_take_array (priv->current_node, array);
   if (priv->is_immutable)
@@ -791,7 +792,8 @@ json_parse_object (JsonParser   *parser,
 
   json_scanner_get_next_token (scanner);
 
-  json_object_seal (object);
+  if (priv->is_immutable)
+    json_object_seal (object);
 
   json_node_take_object (priv->current_node, object);
   if (priv->is_immutable)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]