27 Jul 2012 17:09
[vw7.9][COM] comment wrong about resource releasing in COMObject privateDecrementReferenceCount
Thomas Brodt <thomas.brodt.lists <at> porabo.ch>
2012-07-27 15:09:54 GMT
2012-07-27 15:09:54 GMT
The work on the COM Connect to get rid of reference counting has
another comment issue.
In class COMObject, it says
so according to the comment resources should be released if counter goes to zero, but aren't. Sounds obvious, if you do not count up on AddRef, you cannot release on Release because the counter would always be zero. But comment says differently.
Before the change, there was a line
I'm not yet sure how to deal with the loss of reference counting on the one side, and releasing when done on the other, if you have exposed objects. I'll have to digg more into that. Currently my COMObjects don't disappear any more....
Thomas
In class COMObject, it says
privateDecrementReferenceCount
" Private - decrement the receiver's reference count. This is the sum of the outstanding reference counts on all of its interfaces. Release resources owned by the receiver if its reference count goes to 0. "
referenceCount := referenceCount - 1.
referenceCount < 0
ifTrue:
[COMDevelopmentWarning
raiseSignal: (#WarnNamedTooManyRel1p2p << #com
>> 'Too many releases of <1p> (<2p>)' expandMacrosWith: self
with: referenceCount)].
^referenceCount
so according to the comment resources should be released if counter goes to zero, but aren't. Sounds obvious, if you do not count up on AddRef, you cannot release on Release because the counter would always be zero. But comment says differently.
Before the change, there was a line
referenceCount = 0 ifTrue: [self releaseResources].that did that and that was removed.
I'm not yet sure how to deal with the loss of reference counting on the one side, and releasing when done on the other, if you have exposed objects. I'll have to digg more into that. Currently my COMObjects don't disappear any more....
Thomas
_______________________________________________ vwnc mailing list vwnc <at> cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
RSS Feed