Update of /cvsroot/fxruby/FXRuby/lib/fox
In directory usw-pr-cvs1:/tmp/cvs-serv12848
Modified Files:
Tag: release10
overloads.rb
Log Message:
Added ensure clause for FXFileStream.open() to ensure that the file stream
object is closed after executing the block.
Index: overloads.rb
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/lib/fox/overloads.rb,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** overloads.rb 8 May 2002 21:43:44 -0000 1.7.2.1
--- overloads.rb 24 May 2002 22:17:50 -0000 1.7.2.2
***************
*** 43,60 ****
def FXFileStream.open(filename, save_or_load, container=nil)
fstream = FXFileStream.new(container)
if block_given?
! if fstream.open(filename, save_or_load)
yield fstream
! fstream.close
! else
! # open failed; raise an exception?
! end
! nil
else
! if fstream.open(filename, save_or_load)
! fstream
! else
! # open failed; raise an exception?
! end
end
end
--- 43,55 ----
def FXFileStream.open(filename, save_or_load, container=nil)
fstream = FXFileStream.new(container)
+ status = fstream.open(filename, save_or_load)
if block_given?
! begin
yield fstream
! ensure
! fstream.close
! end
else
! fstream
end
end
|