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

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Feb 17 00:25:50 EST 2011


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

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


           Summary: ReleaseInterfaces is called by GC thread.
    Classification: Mono
           Product: Mono: Class Libraries
           Version: SVN
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: tom_hindle at sil.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=414597)
 --> (http://bugzilla.novell.com/attachment.cgi?id=414597)
Allow ComObjects to now be released by GC patch.

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.13
(KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13

~__ComObject() calls ReleaseInterfaces which can cause underlying ComObject to
be release by GC thread.

This is an issue for COM applications which aren't thread safe. (which is guess
is most of them) for example xulrunner.

Attached is patch that demonstrates one possible solution to this issue.
(allowing the supplying of alternative release mechanism)


WinForms itself could supply a IComObjectReleaser implementation, for example:

// This is only an example.
class IdleComObjectRelease : System.IComObjectReleaser
    {
        public void Add(IntPtr pUnk)
        {
            if (pUnk == IntPtr.Zero)
                return;            
            EventHandler idleHandler = (sender, eventArgs) => {
Marshal.Release(pUnk); Application.Idle -= idleHandler; };            
            Application.Idle += idleHandler;
        }        
    }


and then call:
System.__ComObjectReleaser.Register(new IdleComObjectRelease()); 

Reproducible: Always

Steps to Reproduce:
1.
2.
3.

-- 
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