priv = MODEST_PROTOCOL_REGISTRY_GET_PRIVATE (obj);
- priv->tags_table = g_hash_table_new (g_str_hash, g_str_equal);
+ priv->tags_table = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, (GDestroyNotify) g_hash_table_unref);
priv->priorities = g_hash_table_new (g_direct_hash, g_direct_equal);
modest_protocol_registry_create_tag (obj, TAG_ALL_PROTOCOLS);
static void
modest_protocol_registry_finalize (GObject *obj)
{
+ ModestProtocolRegistryPrivate *priv;
+
+ priv = MODEST_PROTOCOL_REGISTRY_GET_PRIVATE (obj);
+
+ /* Free hash tables */
+ if (priv->tags_table)
+ g_hash_table_unref (priv->tags_table);
+ if (priv->priorities)
+ g_hash_table_unref (priv->priorities);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
tag_table = g_hash_table_lookup (priv->tags_table, node->data);
if (tag_table == NULL)
tag_table = modest_protocol_registry_create_tag (self, node->data);
- g_hash_table_insert (tag_table, GINT_TO_POINTER (modest_protocol_get_type_id (protocol)), protocol);
+ g_hash_table_insert (tag_table, GINT_TO_POINTER (modest_protocol_get_type_id (protocol)), g_object_ref (protocol));
}
g_slist_free (tags_list);
}
g_assert (tag != NULL);
priv = MODEST_PROTOCOL_REGISTRY_GET_PRIVATE (self);
- tag_table = g_hash_table_new (g_direct_hash, g_direct_equal);
+ tag_table = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+ NULL, g_object_unref);
g_hash_table_insert (priv->tags_table, g_strdup (tag), tag_table);
return tag_table;
priv->plugin_factory = NULL;
}
+ if (priv->protocol_registry) {
+ MODEST_DEBUG_VERIFY_OBJECT_LAST_REF(priv->protocol_registry,"");
+ g_object_unref (G_OBJECT(priv->protocol_registry));
+ priv->protocol_registry = NULL;
+ }
+
/* It is important that the account manager is uninitialized after
* the mail op queue is uninitialized because the mail op queue
* cancells any mail operations which in turn access the account