background: Fix a memory leak when monitoring directories
Destroy directory monitors on when the XML object is destroyed. https://bugzilla.gnome.org/show_bug.cgi?id=709243
This commit is contained in:
parent
ca77b20062
commit
5d16f81821
1 changed files with 5 additions and 0 deletions
|
@ -39,6 +39,7 @@ struct CcBackgroundXmlPrivate
|
||||||
GHashTable *wp_hash;
|
GHashTable *wp_hash;
|
||||||
GAsyncQueue *item_added_queue;
|
GAsyncQueue *item_added_queue;
|
||||||
guint item_added_id;
|
guint item_added_id;
|
||||||
|
GSList *monitors; /* GSList of GFileMonitor */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CC_BACKGROUND_XML_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_XML, CcBackgroundXmlPrivate))
|
#define CC_BACKGROUND_XML_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_BACKGROUND_XML, CcBackgroundXmlPrivate))
|
||||||
|
@ -371,6 +372,8 @@ cc_background_xml_add_monitor (GFile *directory,
|
||||||
g_signal_connect (monitor, "changed",
|
g_signal_connect (monitor, "changed",
|
||||||
G_CALLBACK (gnome_wp_file_changed),
|
G_CALLBACK (gnome_wp_file_changed),
|
||||||
data);
|
data);
|
||||||
|
|
||||||
|
data->priv->monitors = g_slist_prepend (data->priv->monitors, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -626,6 +629,8 @@ cc_background_xml_finalize (GObject *object)
|
||||||
|
|
||||||
g_return_if_fail (xml->priv != NULL);
|
g_return_if_fail (xml->priv != NULL);
|
||||||
|
|
||||||
|
g_slist_free_full (xml->priv->monitors, g_object_unref);
|
||||||
|
|
||||||
g_clear_pointer (&xml->priv->wp_hash, g_hash_table_destroy);
|
g_clear_pointer (&xml->priv->wp_hash, g_hash_table_destroy);
|
||||||
if (xml->priv->item_added_id != 0) {
|
if (xml->priv->item_added_id != 0) {
|
||||||
g_source_remove (xml->priv->item_added_id);
|
g_source_remove (xml->priv->item_added_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue