Crossing the VSIP Bridge – Part 2(a)

Sorry this took so long to get out, but I have had some connectivity issues lately
and could not post to this blog.

"urn:schemas-microsoft-com:office:office" />

It seems that my code to Crossing
the VSIP Bridge – Part 2
 has a bug in it that Oleg has
kindly pointed out. Here is the problem:


sp.QueryService(guid1, guid2, ip);


Now what happens with the ip object? Implementations of QueryService first find the
correct object that implements the service, then it performs a QueryInterface, looking
for the interface identified by the second GUID. That interface is returned through
the ip argument. The problem is the IntPtr is GCed, but not the interface that it
points to (since all IntPtr knows is it points to random data). To fix this, after
performing the line of code:


vsuishell = System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(ip);


You should also do this:




to make sure the interface that ip wraps is properly released.

Comments (0)