summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2023-11-08 15:19:45 +0000
committergit <svn-admin@ruby-lang.org>2023-11-08 15:19:52 +0000
commitddcfc9feabf22ed6cc1071e65948a1d512a906fe (patch)
tree9a5ceac7e323e22a5438f43b58601fd80dbbddef /include
parentd80009d1693fe3288be265ecc53ade362d89de59 (diff)
[ruby/tempfile] Fix Tempfile#{dup,clone}
Instead of storing the delegate in @tmpfile, use __getobj__, since delegate library already handles dup/clone for that. Copy the unlinked, mode, and opts instance variables to the returned object when using dup/clone. Split the close/unlink finalizer into two finalizers. The close finalizer always closes when any Tempfile instance is GCed, since each Tempfile instance uses a separate file descriptor. The unlink finalizer unlinks only when the original and all duped/cloned Tempfiles are GCed, since all share the same path. For Tempfile#open, undefine the close finalizer after closing the current file, the redefine the close finalizer with the new file. Fixes [Bug #19441] https://github.com/ruby/tempfile/commit/dafabf9c7b
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions