On Tue, 2007-12-11 at 07:32 +0100, Mikkel Kamstrup Erlandsen wrote: > On 10/12/2007, Jürg Billeter <[EMAIL PROTECTED]> 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 _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
