diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-10-12 14:06:16 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-10-12 14:06:16 +0200 |
| commit | 7112c07abf96405677a0a75d42baf8a7f34f21c2 (patch) | |
| tree | 01224fc42e81fafbc3b6efedd98f9a5630580b8c /src/GraphicObjects | |
| parent | ae08f9c696e2470e747d138ecf2b8c7d643e50a2 (diff) | |
debug dyn event handle clearing
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 505e85a9..6e2d726c 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -1285,16 +1285,22 @@ namespace go foreach (Binding b in Bindings) {
if (string.IsNullOrEmpty (b.DynMethodId))
continue;
- Type dataSourceType = b.Target.Instance.GetType ();
+ MemberReference mr = null;
+ if (b.Target == null)
+ mr = b.Source;
+ else
+ mr = b.Target;
+ Type dataSourceType = mr.Instance.GetType();
EventInfo evtInfo = dataSourceType.GetEvent ("ValueChanged");
FieldInfo evtFi = CompilerServices.GetEventHandlerField (dataSourceType, "ValueChanged");
- MulticastDelegate multicastDelegate = evtFi.GetValue (b.Target.Instance) as MulticastDelegate;
+ MulticastDelegate multicastDelegate = evtFi.GetValue (mr.Instance) as MulticastDelegate;
if (multicastDelegate != null) {
foreach (Delegate d in multicastDelegate.GetInvocationList()) {
if (d.Method.Name == b.DynMethodId)
- evtInfo.RemoveEventHandler (b.Target.Instance, d);
+ evtInfo.RemoveEventHandler (mr.Instance, d);
}
}
+ b.Reset ();
}
}
}
|