[Mono-dev] mono crash on exits when using COM.
tom hindle
tom_hindle at sil.org
Fri Jan 22 18:16:51 EST 2010
Hi all,
I have been investigating some seemingly random crash on exit problems
that our application has been having.
I have managed mostly reliably to reproduce the issue by following this
set of steps:
1. Create a managed object ManagedObj
2. Create a COM object COMObj for which its rcw is likely to be Garbage
collected after ManagedObj and during mono shutdown.
3. Make COMObj contain a ref to ManagedObj's ccw
4. Set ManagedObj ref to null
5. Call GC.Collect() to encourage GC.
If Garbage Collection of COMObj's rcw happens after the Garbage
Collection of ManagedObj's ccw, then when COMObj calls Release on its
ref to ManagedObj's ccw a segv is produced.
Normally it seems that ref counts for the wrappers are respected,
however this doesn't seem to be the case on program shutdown.
Some pseudo code which reproduces the problem:
public class TestComRelease
{
static COMObj cObj;
[Test]
public void Test()
{
ManagedObj mObj = new ManagedObj()
cObj = new COMObj();
cObj.SetManagedRef(mObj);
mObj = null;
GC.Collect();
}
}
I am attempting to find the cause of this in mono. Any pointers would be
grateful received.
Thanks
Tom
More information about the Mono-devel-list
mailing list