Fix lifecycle of an accessible's cache
[platform/upstream/at-spi2-core.git] / atspi / atspi-matchrule.c
index 60060bb..8abeb13 100644 (file)
@@ -81,7 +81,10 @@ atspi_match_rule_class_init (AtspiMatchRuleClass *klass)
  * @statematchtype: An #AtspiCollectionMatchType specifying how to interpret
  *          @states.
  * @attributes: (element-type gchar* gchar*): A #GHashTable specifying
- *          attributes to match.
+ *          attributes to match. To specify multiple attribute values,
+ *          separate each value with a :: If an attribute value contains a :,
+ *          then it can be escaped by preceding it with a \. A backslash can
+ *          likewise be escaped by inserting a double backslash.
  * @attributematchtype: An #AtspiCollectionMatchType specifying how to
  *          interpret @attributes.
  * @interfaces: (element-type gchar*): An array of interfaces to match, or
@@ -119,9 +122,6 @@ atspi_match_rule_new (AtspiStateSet *states,
   AtspiMatchRule *rule = g_object_new (ATSPI_TYPE_MATCH_RULE, NULL);
   int i;
 
-  if (!rule)
-    return NULL;
-
   if (states)
     rule->states = g_object_ref (states);
   rule->statematchtype = statematchtype;
@@ -216,7 +216,8 @@ _atspi_match_rule_marshal (AtspiMatchRule *rule, DBusMessageIter *iter)
   if (!dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_ARRAY, "{ss}",
                                          &iter_dict))
     return FALSE;
-  g_hash_table_foreach (rule->attributes, append_entry, &iter_dict);
+  if (rule->attributes)
+    g_hash_table_foreach (rule->attributes, append_entry, &iter_dict);
   dbus_message_iter_close_container (&iter_struct, &iter_dict);
   dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &d_attributematchtype);