[vw7.9][COM] comment wrong about resource releasing in COMObject privateDecrementReferenceCount

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[vw7.9][COM] comment wrong about resource releasing in COMObject privateDecrementReferenceCount

Thomas Brodt-2
The work on the COM Connect to get rid of reference counting has another comment issue.

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
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc