[geary/wip/778276-better-flag-updates: 2/17] Add a Cancellable for terminating internal folder operations.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/778276-better-flag-updates: 2/17] Add a Cancellable for terminating internal folder operations.
- Date: Tue, 5 Dec 2017 01:57:19 +0000 (UTC)
commit 90a13c7b5e8fddc1f9774c4f07ea05121f056ebb
Author: Michael James Gratton <mike vee net>
Date: Mon Nov 20 19:34:16 2017 +1100
Add a Cancellable for terminating internal folder operations.
* src/engine/imap-engine/imap-engine-minimal-folder.vala (Folder): Add
open_cancellable member, construct new instance when opening and
cancell then null out when closing the folder.
.../imap-engine/imap-engine-minimal-folder.vala | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 5afd866..a7423f3 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -69,8 +69,9 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
private int remote_count = -1;
private Nonblocking.Mutex open_mutex = new Nonblocking.Mutex();
private Nonblocking.Mutex close_mutex = new Nonblocking.Mutex();
+ private Cancellable? open_cancellable = null;
+
-
/**
* Called when the folder is closing (and not reestablishing a connection) and will be flushing
* the replay queue. Subscribers may add ReplayOperations to the list, which will be enqueued
@@ -579,6 +580,8 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
// reset to force waiting in wait_for_close_async()
closed_semaphore.reset();
+
+ this.open_cancellable = new Cancellable();
// Unless NO_DELAY is set, do NOT open the remote side here; wait for the ReplayQueue to
// require a remote connection or wait_for_open_async() to be called ... this allows for
@@ -964,6 +967,10 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
// Returns the remote_folder, if it was set
private Imap.Folder? clear_remote_folder() {
+ // Cancel any internal pending operations before unhooking
+ this.open_cancellable.cancel();
+ this.open_cancellable = null;
+
if (remote_folder != null) {
// disconnect signals before ripping out reference
remote_folder.appended.disconnect(on_remote_appended);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]