mirror of
https://github.com/Kopano-dev/kopano-ol-extension.git
synced 2023-10-10 13:37:40 +02:00
[KOE-92] Turns out item Add and Change events pass a handle to a COM object that must be released. Changed the event handler to release it, with the global option ReleaseItemEventWrappers (default true) to revert back to old behaviour.
This commit is contained in:
parent
9a37708b53
commit
8d79f9f2ee
@ -127,6 +127,16 @@ namespace Acacia
|
||||
}
|
||||
private static readonly BoolOption HOOK_ITEM_EVENTS = new BoolOption("HookItemEvents", true);
|
||||
|
||||
[AcaciaOption("Enables or disables the release of wrappers for item events. " +
|
||||
"This should normally be enabled, but can be disabled to debug exceptions.")]
|
||||
virtual public bool ReleaseItemEventWrappers
|
||||
{
|
||||
get { return GetOption(null, RELEASE_ITEM_EVENT_WRAPPERS); }
|
||||
set { SetOption(null, RELEASE_ITEM_EVENT_WRAPPERS, value); }
|
||||
}
|
||||
private static readonly BoolOption RELEASE_ITEM_EVENT_WRAPPERS = new BoolOption("ReleaseItemEventWrappers", true);
|
||||
|
||||
|
||||
#region UI Options
|
||||
|
||||
[AcaciaOption("Completely enables or disables modifications to the Outlook UI." +
|
||||
|
@ -113,10 +113,9 @@ namespace Acacia.Stubs.OutlookWrappers
|
||||
{
|
||||
get
|
||||
{
|
||||
using (ComRelease com = new ComRelease())
|
||||
using (IBase parent = Mapping.Wrap<IBase>(_item.Parent))
|
||||
{
|
||||
NSOutlook.Folder parent = com.Add(_item.Parent);
|
||||
return parent?.EntryID;
|
||||
return parent.EntryID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,14 +189,11 @@ namespace Acacia.Stubs.OutlookWrappers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_itemAdd != null)
|
||||
using (IItem item = Mapping.Wrap<IItem>(objItem, GlobalOptions.INSTANCE.ReleaseItemEventWrappers))
|
||||
{
|
||||
using (IItem item = Mapping.Wrap<IItem>(objItem, false))
|
||||
if (item != null && _itemAdd != null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
_itemAdd(item);
|
||||
}
|
||||
_itemAdd(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,14 +236,11 @@ namespace Acacia.Stubs.OutlookWrappers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_itemChange != null)
|
||||
using (IItem item = Mapping.Wrap<IItem>(objItem, GlobalOptions.INSTANCE.ReleaseItemEventWrappers))
|
||||
{
|
||||
using (IItem item = Mapping.Wrap<IItem>(objItem, false))
|
||||
if (item != null && _itemChange != null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
_itemChange(item);
|
||||
}
|
||||
_itemChange(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user