Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Remove()

static ? Delegate System.Runtime.InteropServices.ComEventsHelper.Remove ( object rcw,
Guid iid,
int dispid,
Delegate d )
inlinestatic

Definition at line 19 of file ComEventsHelper.cs.

20 {
21 lock (rcw)
22 {
23 ComEventsInfo comEventsInfo = ComEventsInfo.Find(rcw);
24 if (comEventsInfo == null)
25 {
26 return null;
27 }
28 ComEventsSink comEventsSink = comEventsInfo.FindSink(ref iid);
29 if (comEventsSink == null)
30 {
31 return null;
32 }
33 ComEventsMethod comEventsMethod = comEventsSink.FindMethod(dispid);
34 if (comEventsMethod == null)
35 {
36 return null;
37 }
38 comEventsMethod.RemoveDelegate(d);
39 if (comEventsMethod.Empty)
40 {
41 comEventsMethod = comEventsSink.RemoveMethod(comEventsMethod);
42 }
43 if (comEventsMethod == null)
44 {
45 comEventsSink = comEventsInfo.RemoveSink(comEventsSink);
46 }
47 if (comEventsSink == null)
48 {
49 Marshal.SetComObjectData(rcw, typeof(ComEventsInfo), null);
50 GC.SuppressFinalize(comEventsInfo);
51 }
52 return d;
53 }
54 }

References System.Runtime.InteropServices.ComEventsMethod.Empty, System.Runtime.InteropServices.ComEventsInfo.Find(), System.Runtime.InteropServices.ComEventsSink.FindMethod(), System.Runtime.InteropServices.ComEventsInfo.FindSink(), System.Runtime.InteropServices.ComEventsMethod.RemoveDelegate(), System.Runtime.InteropServices.ComEventsSink.RemoveMethod(), System.Runtime.InteropServices.ComEventsInfo.RemoveSink(), System.Runtime.InteropServices.Marshal.SetComObjectData(), and System.GC.SuppressFinalize().

Referenced by System.Runtime.InteropServices.ComAwareEventInfo.RemoveEventHandler().