Wrong finalizer in FileDescriptor

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

Wrong finalizer in FileDescriptor

Holger Freyther
Hi Paolo,

FileDescr>>#finalize [
        "Close the file if it is still open by the time the object becomes
         garbage."

        <category: 'basic'>
        AllOpenFiles remove: self ifAbsent: [].
        self isOpen ifFalse: [self close]
]


This means that if the file is not open... close will be called. Is that your
intention?

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Wrong finalizer in FileDescriptor

Paolo Bonzini-2
On 04/28/2011 11:02 PM, Holger Hans Peter Freyther wrote:

> FileDescr>>#finalize [
>          "Close the file if it is still open by the time the object becomes
>           garbage."
>
>          <category: 'basic'>
>          AllOpenFiles remove: self ifAbsent: [].
>          self isOpen ifFalse: [self close]
> ]
>
>
> This means that if the file is not open... close will be called. Is that your
> intention?
>

Obviously not, thanks.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk