[gnome-photos] item-manager: The collection path might have NULL items
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] item-manager: The collection path might have NULL items
- Date: Wed, 13 Nov 2013 18:25:10 +0000 (UTC)
commit dbc06744124dd864f88a0a19da1cba3daf160c2f
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Oct 31 17:14:27 2013 +0100
item-manager: The collection path might have NULL items
This fixes a CRITICAL when clicking the back button to come out of an
album.
src/photos-item-manager.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-item-manager.c b/src/photos-item-manager.c
index 895fb69..3f5c2ac 100644
--- a/src/photos-item-manager.c
+++ b/src/photos-item-manager.c
@@ -125,6 +125,13 @@ photos_item_manager_changes_pending (PhotosTrackerChangeMonitor *monitor, GHashT
}
+static void
+photos_item_manager_collection_path_free_foreach (gpointer data, gpointer user_data)
+{
+ g_clear_object (&data);
+}
+
+
static gboolean
photos_item_manager_set_active_object (PhotosBaseManager *manager, GObject *object)
{
@@ -189,8 +196,12 @@ photos_item_manager_dispose (GObject *object)
PhotosItemManager *self = PHOTOS_ITEM_MANAGER (object);
PhotosItemManagerPrivate *priv = self->priv;
- g_queue_free_full (priv->collection_path, g_object_unref);
- priv->collection_path = NULL;
+ if (priv->collection_path != NULL)
+ {
+ g_queue_foreach (priv->collection_path, photos_item_manager_collection_path_free_foreach, NULL);
+ g_queue_free (priv->collection_path);
+ priv->collection_path = NULL;
+ }
g_clear_object (&priv->col_mngr);
g_clear_object (&priv->monitor);
@@ -242,7 +253,7 @@ photos_item_manager_activate_previous_collection (PhotosItemManager *self)
collection = G_OBJECT (g_queue_pop_head (priv->collection_path));
photos_base_manager_set_active_object (priv->col_mngr, collection);
- g_object_unref (collection);
+ g_clear_object (&collection);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]