Yes, the garbage collector runs at random times. You can explicitly release
the COMobject in C# by calling Marshal.ReleaseComObject.
However, the problem may also be that you are using a delete on the
COleDataSource-object, instead of that, you should use InternalRelease.
---------
- G Himangi, Sky Software http://www.ssware.com
Shell MegaPack : GUI Controls For Drop-In Windows Explorer like Shell
Browsing Functionality For Your App (.Net & ActiveX Editions).
EZNamespaceExtensions.Net : Develop namespace extensions rapidly in .Net
EZShellExtensions.Net : Develop all shell extensions,explorer bars and BHOs
rapidly in .Net
---------
> Hi,
>
[quoted text clipped - 25 lines]
> Thanks,
> Wilfried
whagedorn - 21 Sep 2007 10:03 GMT
The main problem is, that I don't have any access to the
COleDataSource-object, which is encapsulate
in a DragEventsArg-object on the c# side. It is further wrapped from the
interop layer ( e.g. COleConvert ), so there is no chance to release it from
the drop target.
I have tried to call GC.Collect() after setting the DragEventsArg-object to
null, but without any success.
> Yes, the garbage collector runs at random times. You can explicitly
> release the COMobject in C# by calling Marshal.ReleaseComObject.
[quoted text clipped - 40 lines]
>> Thanks,
>> Wilfried
Christian Fröschlin - 21 Sep 2007 14:54 GMT
> I have tried to call GC.Collect() after setting the
> DragEventsArg-object to null, but without any success.
That wouldn't help much unless you also
called GC.WaitForPendingFinalizers().
whagedorn - 24 Sep 2007 09:07 GMT
Hello Christian ,
I've tried several things to release the COM-Object, but I believe the main
problem is,
that I cannot get access to the wrapped interface itself.
Here's a c# code fragment of my project. The drop source is a
MFC-Application which
creates a COleDataSource object on the stack and calls then its DoDragDrop()
method.
void list_DragDrop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(JVSDragDropFormat))
{
e.Data.SetData(JVSDragDropFormat, null);
// object data = e.Data.GetData(JVSDragDropFormat);
// data = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
Any ideas ?
Wilfried
>> I have tried to call GC.Collect() after setting the DragEventsArg-object
>> to null, but without any success.
>
> That wouldn't help much unless you also
> called GC.WaitForPendingFinalizers().