[Mono-bugs] [Bug 672879] ReleaseInterfaces is called by GC thread.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Sep 2 14:21:27 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=672879

https://bugzilla.novell.com/show_bug.cgi?id=672879#c7


--- Comment #7 from Robert Jordan <robertj at gmx.net> 2011-09-02 18:21:26 UTC ---
No, the finalizer could be implemented like this:

~__ComObject ()
{
    var ctx = SynchronizationContext.Current;
    if (ctx != null)
        SynchronizationContext.Current.Post(delegate {
             ReleaseInterfaces ();
        });
    else
        ReleaseInterfaces ();
}


If you app is based on WindowsForms, you don't have to do anything, because
there is an SynContext already set. Otherwise you'd have to inherit from
SynchronizationContext, implement Post and install it with
SetSynchronizationContext().

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list