[clutter/clutter-1.22] script: Do not overwrite ObjectInfo fields



commit d005c6a8809fe48ce5c8e5a9f0f620e4f60bb7e6
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Dec 14 23:05:17 2014 +0000

    script: Do not overwrite ObjectInfo fields
    
    When merging multiple definitions it's possible that the ObjectInfo
    fields may get overwritten. Instead of trampling over the fields, we
    should reset them only when they actually change — especially the
    "is_actor" one, which controls the destruction of the objects when
    unmerging happens.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=669743

 clutter/clutter-script-parser.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/clutter/clutter-script-parser.c b/clutter/clutter-script-parser.c
index 3ed900c..1611037 100644
--- a/clutter/clutter-script-parser.c
+++ b/clutter/clutter-script-parser.c
@@ -1083,6 +1083,7 @@ clutter_script_parser_object_end (JsonParser *json_parser,
       oinfo = g_slice_new0 (ObjectInfo);
       oinfo->merge_id = _clutter_script_get_last_merge_id (script);
       oinfo->id = g_strdup (id_);
+      oinfo->has_unresolved = TRUE;
 
       class_name = json_object_get_string_member (object, "type");
       oinfo->class_name = g_strdup (class_name);
@@ -1107,6 +1108,8 @@ clutter_script_parser_object_end (JsonParser *json_parser,
       oinfo->children = parse_children (oinfo, val);
 
       json_object_remove_member (object, "children");
+
+      oinfo->has_unresolved = TRUE;
     }
 
   if (json_object_has_member (object, "signals"))
@@ -1115,9 +1118,9 @@ clutter_script_parser_object_end (JsonParser *json_parser,
       oinfo->signals = parse_signals (script, oinfo, val);
 
       json_object_remove_member (object, "signals");
-    }
 
-  oinfo->is_actor = FALSE;
+      oinfo->has_unresolved = TRUE;
+    }
 
   if (strcmp (oinfo->class_name, "ClutterStage") == 0 &&
       json_object_has_member (object, "is-default"))
@@ -1132,9 +1135,6 @@ clutter_script_parser_object_end (JsonParser *json_parser,
   else
     oinfo->is_stage_default = FALSE;
 
-  oinfo->is_unmerged = FALSE;
-  oinfo->has_unresolved = TRUE;
-
   members = json_object_get_members (object);
   for (l = members; l; l = l->next)
     {
@@ -1175,6 +1175,7 @@ clutter_script_parser_object_end (JsonParser *json_parser,
       pinfo->is_layout = g_str_has_prefix (name, "layout::") ? TRUE : FALSE;
 
       oinfo->properties = g_list_prepend (oinfo->properties, pinfo);
+      oinfo->has_unresolved = TRUE;
     }
 
   g_list_free (members);
@@ -2169,12 +2170,12 @@ _clutter_script_construct_object (ClutterScript *script,
 
       if (G_UNLIKELY (oinfo->gtype == G_TYPE_INVALID))
         return;
-
-      oinfo->is_actor = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_ACTOR);
-      if (oinfo->is_actor)
-        oinfo->is_stage = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_STAGE);
     }
 
+  oinfo->is_actor = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_ACTOR);
+  if (oinfo->is_actor)
+    oinfo->is_stage = g_type_is_a (oinfo->gtype, CLUTTER_TYPE_STAGE);
+
   if (oinfo->is_stage && oinfo->is_stage_default)
     {
       ClutterStageManager *manager = clutter_stage_manager_get_default ();


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