Make sure to only update UI if calculated rating corresponds to current mail item
authorThomas
Wed, 10 Apr 2019 16:20:10 +0200
changeset 2612d46de99a6317
parent 2611 6c532dd283a9
child 2614 105311c70875
child 2615 ad5b3224993e
Make sure to only update UI if calculated rating corresponds to current mail item
CryptableMailItem.cs
MsgProcessor.cs
Wrappers/WatchedWindow.cs
     1.1 --- a/CryptableMailItem.cs	Wed Mar 27 08:47:21 2019 +0100
     1.2 +++ b/CryptableMailItem.cs	Wed Apr 10 16:20:10 2019 +0200
     1.3 @@ -1683,6 +1683,7 @@
     1.4                  {
     1.5                      args.ProcessedRating = result.Rating;
     1.6                      args.PropertiesToSet = result.PropertiesToSet;
     1.7 +                    args.EntryId = this.internalMailItem?.EntryID;
     1.8                  }
     1.9                  else
    1.10                  {
     2.1 --- a/MsgProcessor.cs	Wed Mar 27 08:47:21 2019 +0100
     2.2 +++ b/MsgProcessor.cs	Wed Apr 10 16:20:10 2019 +0200
     2.3 @@ -890,6 +890,11 @@
     2.4          internal class ProcessingCompletedEventArgs : EventArgs
     2.5          {
     2.6              /// <summary>
     2.7 +            /// The entry id of the message that has been processed.
     2.8 +            /// </summary>
     2.9 +            public string EntryId;
    2.10 +
    2.11 +            /// <summary>
    2.12              /// Whether the ProcessedMessage corresponds to a mirror (true) or the original message (false).
    2.13              /// </summary>
    2.14              public bool IsMirror;
    2.15 @@ -925,6 +930,7 @@
    2.16              /// </summary>
    2.17              public ProcessingCompletedEventArgs()
    2.18              {
    2.19 +                this.EntryId = null;
    2.20                  this.IsMirror = false;
    2.21                  this.ProcessedDecryptionFlags = pEpDecryptFlags.pEpDecryptFlagsNone;
    2.22                  this.ProcessedMessage = null;
    2.23 @@ -939,6 +945,7 @@
    2.24              /// <param name="rating">The rating after the processing completes.</param>
    2.25              public ProcessingCompletedEventArgs(pEpRating rating)
    2.26              {
    2.27 +                this.EntryId = null;
    2.28                  this.IsMirror = false;
    2.29                  this.ProcessedDecryptionFlags = pEpDecryptFlags.pEpDecryptFlagsNone;
    2.30                  this.ProcessedMessage = null;
     3.1 --- a/Wrappers/WatchedWindow.cs	Wed Mar 27 08:47:21 2019 +0100
     3.2 +++ b/Wrappers/WatchedWindow.cs	Wed Apr 10 16:20:10 2019 +0200
     3.3 @@ -1042,6 +1042,13 @@
     3.4  
     3.5              try
     3.6              {
     3.7 +                // Make sure that the calculated result corresponds to the currently selected mail item
     3.8 +                if (e?.EntryId?.Equals(this.CurrentMailItem?.EntryID) != true)
     3.9 +                {
    3.10 +                    Log.Verbose("MailItem_ProcessingComplete: Calculated rating doesn't correspond to current mail item. Skipping...");
    3.11 +                    return;
    3.12 +                }
    3.13 +
    3.14                  // Marshal code back to UI thread as necessary
    3.15                  KeySyncWizard.Wizard.Dispatcher.Invoke(new Action(() =>
    3.16                  {