Re: [Vala] Possibly, error in code generator
- From: Jürg Billeter <j bitron ch>
- To: Mikkel Kamstrup Erlandsen <mikkel kamstrup gmail com>
- Cc: vala <vala-list gnome org>
- Subject: Re: [Vala] Possibly, error in code generator
- Date: Tue, 11 Dec 2007 10:10:55 +0100
On Tue, 2007-12-11 at 07:32 +0100, Mikkel Kamstrup Erlandsen wrote:
On 10/12/2007, Jürg Billeter <j bitron ch> wrote:
There is another issue with the code: you may not call close()
in this
situation as Vala calls close() automatically when the file
variable
goes out of scope (or when you explicitly set it to null). I
should fix
valac to disallow manual close calls in such cases.
Is it standard .Net to throw an error multiple close calls? Java does
not complian...
No, POSIX fclose() works like that. The reason is that closing the file
and releasing the allocated memory is the same operation, so the FILE
pointer gets invalid after calling fclose() and further use of the
pointer will lead to crashes. As written before, future versions of
valac won't allow to call close() manually for variables using automatic
memory management.
Maybe GIO will handle this.
Yes, it won't be an issue with GIO. Streams will also be closed
automatically when they go out of scope and you can also close them
explicitly - even multiple times - without causing crashes.
Jürg
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]