[geary/wip/713150-conversations] Fix soft assertion when EmailFlags is null in search predicate
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713150-conversations] Fix soft assertion when EmailFlags is null in search predicate
- Date: Tue, 10 Mar 2015 21:17:21 +0000 (UTC)
commit 5803a3d610eff59e23cae8caef95546d0c95a1a8
Author: Jim Nelson <jim yorba org>
Date: Mon Mar 9 13:52:50 2015 -0700
Fix soft assertion when EmailFlags is null in search predicate
src/client/composer/composer-widget.vala | 4 ++--
src/engine/api/geary-account.vala | 2 +-
src/engine/app/app-conversation-monitor.vala | 15 +++++++++++----
3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index da69c8b..a658622 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -651,8 +651,8 @@ public class ComposerWidget : Gtk.EventBox {
// TODO: Folder blacklist
// NOTE: This is called from a background thread.
private bool local_search_predicate(Geary.EmailIdentifier email_id, Geary.Email.Field fields,
- Gee.Collection<Geary.FolderPath?> known_paths, Geary.EmailFlags flags) {
- return !flags.contains(Geary.EmailFlags.DRAFT);
+ Gee.Collection<Geary.FolderPath?> known_paths, Geary.EmailFlags? flags) {
+ return flags != null && !flags.contains(Geary.EmailFlags.DRAFT);
}
public async void restore_draft_state_async(Geary.Account account) {
diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala
index f624274..0677592 100644
--- a/src/engine/api/geary-account.vala
+++ b/src/engine/api/geary-account.vala
@@ -68,7 +68,7 @@ public abstract class Geary.Account : BaseObject {
* so use appropriate locking.
*/
public delegate bool EmailSearchPredicate(Geary.EmailIdentifier email_id, Geary.Email.Field fields,
- Gee.Collection<Geary.FolderPath?> known_paths, Geary.EmailFlags flags);
+ Gee.Collection<Geary.FolderPath?> known_paths, Geary.EmailFlags? flags);
public Geary.AccountInformation information { get; protected set; }
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 8308e9d..ec7bc94 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -48,9 +48,10 @@ public class Geary.App.ConversationMonitor : BaseObject {
// Add "no folders" so we omit results that have been deleted permanently from the server.
path_blacklist.add(null);
}
+
// NOTE: This is called from a background thread.
public bool search_predicate(EmailIdentifier email_id, Email.Field fields,
- Gee.Collection<FolderPath?> known_paths, EmailFlags flags) {
+ Gee.Collection<FolderPath?> known_paths, EmailFlags? flags) {
// don't want partial emails
if (!fields.fulfills(required_fields))
return false;
@@ -61,7 +62,7 @@ public class Geary.App.ConversationMonitor : BaseObject {
return true;
// Don't add drafts (unless in Drafts folder, above)
- if (flags.contains(EmailFlags.DRAFT))
+ if (flags != null && flags.contains(EmailFlags.DRAFT))
return false;
// If in a blacklisted path, don't add
@@ -658,13 +659,19 @@ public class Geary.App.ConversationMonitor : BaseObject {
operation_queue.add(new FillWindowOperation(this, false));
}
+ private bool is_folder_external_conversation_source(Folder folder) {
+ return !folder.path.equal_to(this.folder.path)
+ && !folder.properties.is_local_only
+ && !folder.properties.is_virtual;
+ }
+
private void on_account_email_added(Folder folder, Gee.Collection<EmailIdentifier> added_ids) {
- if (!folder.path.equal_to(this.folder.path))
+ if (is_folder_external_conversation_source(folder))
operation_queue.add(new ExternalAppendOperation(this, folder, added_ids));
}
private void on_account_email_removed(Folder folder, Gee.Collection<EmailIdentifier> removed_ids) {
- if (folder.path.equal_to(this.folder.path))
+ if (!is_folder_external_conversation_source(folder))
return;
operation_queue.add(new ExternalRemoveOperation(this, folder, removed_ids));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]