Small fixes, debug tweaks

This commit is contained in:
Patrick Simpson 2017-02-09 10:14:39 +01:00
parent 773f0b07bf
commit 471b9c80c7
4 changed files with 16 additions and 13 deletions

View File

@ -163,12 +163,8 @@ namespace Acacia.Features.DebugSupport
}
private void GarbageCollect()
{
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
{
Util.GarbageCollect();
UpdateFields();
}

View File

@ -48,7 +48,7 @@ namespace Acacia.Features.DebugSupport
public override void AfterStartup()
{
ShowAbout();
//ShowAbout();
}
#region About dialog
@ -79,7 +79,9 @@ namespace Acacia.Features.DebugSupport
public void ShowSettings()
{
new SettingsDialog().ShowDialog();
//new SettingsDialog().ShowDialog();
ThisAddIn.Instance.GetFeature<GAB.FeatureGAB>()?.FullResync();
Tasks.Task(this, "GC", () => Util.GarbageCollect());
}
public override FeatureSettings GetSettings()

View File

@ -208,8 +208,6 @@ namespace Acacia.Utils
#region Implementation
private readonly HashSet<MailEventHooker> _keepAlives = new HashSet<MailEventHooker>();
public MailEvents(IAddIn app)
{
app.ItemLoad += OnItemLoad;
@ -221,7 +219,7 @@ namespace Acacia.Utils
NSOutlook.ItemEvents_10_Event hasEvents = item as NSOutlook.ItemEvents_10_Event;
if (hasEvents != null)
{
_keepAlives.Add(new MailEventHooker(item, hasEvents, this));
new MailEventHooker(item, hasEvents, this);
}
else ComRelease.Release(item);
}
@ -248,8 +246,6 @@ namespace Acacia.Utils
{
Logger.Instance.Debug(this, "DoRelease: {0}", _id);
_events._keepAlives.Remove(this);
ComRelease.Release(_item);
_item = null;
ComRelease.Release(_itemEvents);

View File

@ -79,5 +79,14 @@ namespace Acacia.Utils
}
ComRelease.Release(source);
}
public static void GarbageCollect()
{
for (int i = 0; i < 4; ++i)
{
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}
}