[gnome-photos] collection-icon-watcher: Remove the weak pointer during destruction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] collection-icon-watcher: Remove the weak pointer during destruction
- Date: Thu, 7 May 2015 18:18:04 +0000 (UTC)
commit eea31c8f8995ebd2ac73e85f8cba2e81b3b52e68
Author: Debarshi Ray <debarshir gnome org>
Date: Thu May 7 20:10:15 2015 +0200
collection-icon-watcher: Remove the weak pointer during destruction
Otherwise, if the object (ie. priv->collection) outlives the weak
pointer location (ie. &priv->collection), then we will be accessing
invalid memory during the object's destruction.
src/photos-collection-icon-watcher.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-collection-icon-watcher.c b/src/photos-collection-icon-watcher.c
index a9f358f..cdd6e05 100644
--- a/src/photos-collection-icon-watcher.c
+++ b/src/photos-collection-icon-watcher.c
@@ -372,8 +372,12 @@ static void
photos_collection_icon_watcher_finalize (GObject *object)
{
PhotosCollectionIconWatcher *self = PHOTOS_COLLECTION_ICON_WATCHER (object);
+ PhotosCollectionIconWatcherPrivate *priv = self->priv;
+
+ g_list_free_full (priv->urns, g_free);
- g_list_free_full (self->priv->urns, g_free);
+ if (priv->collection != NULL)
+ g_object_remove_weak_pointer (G_OBJECT (priv->collection), (gpointer *) &priv->collection);
G_OBJECT_CLASS (photos_collection_icon_watcher_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]