[gnome-photos] organize-collection-view: Cancel set_collection_job during destruction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] organize-collection-view: Cancel set_collection_job during destruction
- Date: Fri, 9 Feb 2018 11:19:48 +0000 (UTC)
commit 633547275945c4e0e5f262652054af273a5f54bd
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Feb 8 00:17:02 2018 +0100
organize-collection-view: Cancel set_collection_job during destruction
https://gitlab.gnome.org/GNOME/gnome-photos/issues/43
src/photos-organize-collection-view.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-organize-collection-view.c b/src/photos-organize-collection-view.c
index b8a26590..108d399a 100644
--- a/src/photos-organize-collection-view.c
+++ b/src/photos-organize-collection-view.c
@@ -81,19 +81,31 @@ photos_organize_collection_view_check_cell (GtkTreeViewColumn *tree_column,
static void
photos_organize_collection_view_set_collection_executed (GObject *source_object, GAsyncResult *res, gpointer
user_data)
{
- PhotosOrganizeCollectionView *self = PHOTOS_ORGANIZE_COLLECTION_VIEW (user_data);
+ PhotosOrganizeCollectionView *self;
GError *error;
PhotosSetCollectionJob *job = PHOTOS_SET_COLLECTION_JOB (source_object);
error = NULL;
if (!photos_set_collection_job_finish (job, res, &error))
{
- g_warning ("Unable to set collection: %s", error->message);
- g_error_free (error);
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ g_error_free (error);
+ goto out;
+ }
+ else
+ {
+ g_warning ("Unable to set collection: %s", error->message);
+ g_error_free (error);
+ }
}
+ self = PHOTOS_ORGANIZE_COLLECTION_VIEW (user_data);
+
photos_organize_collection_model_refresh_collection_state (PHOTOS_ORGANIZE_COLLECTION_MODEL (self->model));
- g_object_unref (self);
+
+ out:
+ return;
}
@@ -113,9 +125,9 @@ photos_organize_collection_view_check_toggled (PhotosOrganizeCollectionView *sel
job = photos_set_collection_job_new (coll_urn, !state);
photos_set_collection_job_run (job,
- NULL,
+ self->cancellable,
photos_organize_collection_view_set_collection_executed,
- g_object_ref (self));
+ self);
g_object_unref (job);
g_free (coll_urn);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]