Fixes to small store init issues

This commit is contained in:
Patrick Simpson 2017-02-15 11:53:56 +01:00
parent 66601246b1
commit 16f791818f
2 changed files with 8 additions and 4 deletions

View File

@ -160,9 +160,12 @@ namespace Acacia.Stubs.OutlookWrappers
foreach (KeyValuePair<string, AccountWrapper> remove in removed)
{
Logger.Instance.Debug(this, "Account removed: {0} - {1}", remove.Value, remove.Key);
_accountsBySmtp.Remove(remove.Value.SmtpAddress);
_accountsByStoreId.Remove(remove.Key);
OnAccountRemoved(remove.Value);
if (remove.Value != null)
{
_accountsBySmtp.Remove(remove.Value.SmtpAddress);
OnAccountRemoved(remove.Value);
}
}
}
catch (System.Exception e)

View File

@ -21,6 +21,7 @@ using Acacia.Utils;
using Acacia.ZPush.Connect;
using Microsoft.Win32;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -227,7 +228,7 @@ namespace Acacia.ZPush
}
}
private readonly Dictionary<FolderRegistration, FolderWatcher> _folderWatchers = new Dictionary<FolderRegistration, FolderWatcher>();
private readonly ConcurrentDictionary<FolderRegistration, FolderWatcher> _folderWatchers = new ConcurrentDictionary<FolderRegistration, FolderWatcher>();
private ZPushFolder _rootFolder;
private void HandleFolderWatchers(ZPushAccount account)
@ -245,7 +246,7 @@ namespace Acacia.ZPush
if (!_folderWatchers.TryGetValue(folder, out watcher))
{
watcher = new FolderWatcher();
_folderWatchers.Add(folder, watcher);
_folderWatchers.TryAdd(folder, watcher);
}
watcher.Discovered += handler;