Re: DispatchPtr not releasing
Normand Mongeau <[email protected]> Thu, 22 Sep 2005 23:20:37 -0400
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <005b01c5bfed$c4ccd600$af00a8c0@tocnm> |
hmm, I'm not very familiar with this discussion list, but nobody answers questions? ----- Original Message ----- From: "Normand Mongeau" <[email protected]> To: <[email protected]> Sent: Thursday, September 01, 2005 4:32 PM Subject: Re: [JAWIN] DispatchPtr not releasing > It's not easy to post code. I'll try to explain more in depth. > > DispatchPtr instances are kind of "smart" instances, because somewhere > deep > in the machinery of COM a Release gets sent when instances go out of > scope. > This is easily verified with the following: create a COM class, and > implement a FinalRelease method just to track when it gets called. So if > you have code like this: > > instA = new A(). > > when the instA variable goes out of scope the FinalRelease method will get > called automatically (it's called by the Release() method). > > My problem is that if I need to pass the A instance to another COM class, > the A never gets finalized. This is also easy to verify with code like > this: > > instA = new A(). > instB = new B(). > instB->invokeSomeMethodPassingTheOtherInstance(instA). > > the finalization of the B instance will happen, but not the finalization > of > the A instance. > > This only happens through JAWIN. It's as if an extra refCount was added > to > the A instance, thus not releasing it. > > Regards, > > Normand > > ----- Original Message ----- > From: "Morten Andersen" <[email protected]> > To: <[email protected]> > Sent: Thursday, September 01, 2005 11:55 AM > Subject: Re: [JAWIN] DispatchPtr not releasing > > >> Hi Norm, >> >> I am at least not sure I understand your problem 100%. So if possible, >> can you please post a couple of lines of code that shows your problem >> >> Best Regards, and sorry for not being so quick in answering. >> Morten >> >> Normand Mongeau wrote: >>> So nobody knows about this, or did I not formulate my question clearly >>> enough? >>> >>> Norm >>> >>> ----- Original Message ----- >>> From: "Normand Mongeau" <[email protected]> >>> To: <[email protected]> >>> Sent: Monday, August 29, 2005 5:36 PM >>> Subject: [JAWIN] DispatchPtr not releasing >>> >>> >>>> Hi, >>>> >>>> I have a problem with subclasses of DispatchPtr, which do not get >>>> released >>>> when they are passed as arguments of method invocations. >>>> >>>> To determine this, I implemented a FinalRelease method in my subclass, >>>> and >>>> when I instantiate my subclass and do nothing special with it, the >>>> FinalRelease method of my COM object gets called. But if I send the >>>> instance as an argument to another COM object (the method does nothing >>>> with the instance received), then the FinalRelease method of my COM >>>> never >>>> gets called. >>>> >>>> Does this ring a bell with anyone? >>>> >>>> Thanks, >>>> >>>> Norm >>> >>>