[gnome-photos] application: Clear pending miner timeout when the main window is gone
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] application: Clear pending miner timeout when the main window is gone
- Date: Wed, 18 Nov 2015 14:53:41 +0000 (UTC)
commit 0b8a72f7c75a25fa69b3be5764353ca78b62e214
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Nov 16 11:29:46 2015 +0100
application: Clear pending miner timeout when the main window is gone
src/photos-application.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index b58efd5..17a763d 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -94,6 +94,7 @@ struct _PhotosApplicationPrivate
PhotosSearchProvider *search_provider;
TrackerExtractPriority *extract_priority;
guint create_miners_count;
+ guint refresh_miner_id;
guint32 activation_timestamp;
gulong source_added_id;
gulong source_removed_id;
@@ -258,6 +259,12 @@ photos_application_destroy (PhotosApplication *self)
priv->main_window = NULL;
+ if (priv->refresh_miner_id != 0)
+ {
+ g_source_remove (priv->refresh_miner_id);
+ priv->refresh_miner_id = 0;
+ }
+
g_cancellable_cancel (priv->create_window_cancellable);
g_clear_object (&priv->create_window_cancellable);
priv->create_window_cancellable = g_cancellable_new ();
@@ -646,8 +653,10 @@ static gboolean
photos_application_refresh_miner_timeout (gpointer user_data)
{
PhotosApplicationRefreshData *data = (PhotosApplicationRefreshData *) user_data;
+ PhotosApplication *self = data->application;
- photos_application_refresh_miner_now (data->application, data->miner);
+ self->priv->refresh_miner_id = 0;
+ photos_application_refresh_miner_now (self, data->miner);
return G_SOURCE_REMOVE;
}
@@ -661,6 +670,8 @@ photos_application_refresh_db (GObject *source_object, GAsyncResult *res, gpoint
GomMiner *miner = GOM_MINER (source_object);
PhotosApplicationRefreshData *data;
+ g_assert (priv->refresh_miner_id == 0);
+
priv->miners_running = g_list_remove (priv->miners_running, miner);
g_signal_emit (self, signals[MINERS_CHANGED], 0, priv->miners_running);
@@ -674,11 +685,11 @@ photos_application_refresh_db (GObject *source_object, GAsyncResult *res, gpoint
}
data = photos_application_refresh_data_new (self, miner);
- g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
- MINER_REFRESH_TIMEOUT,
- photos_application_refresh_miner_timeout,
- data,
- (GDestroyNotify) photos_application_refresh_data_free);
+ priv->refresh_miner_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
+ MINER_REFRESH_TIMEOUT,
+ photos_application_refresh_miner_timeout,
+ data,
+ (GDestroyNotify)
photos_application_refresh_data_free);
out:
g_object_unref (self);
@@ -1404,6 +1415,8 @@ photos_application_finalize (GObject *object)
g_critical ("Application is being destroyed while %u miner proxies are still being created.",
priv->create_miners_count);
+ g_assert (priv->refresh_miner_id == 0);
+
G_OBJECT_CLASS (photos_application_parent_class)->finalize (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]