October 14, 2023 [Issue 24165] Failed readf leaves File in inconsistent state | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24165 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Dlang Bot <dlang-bot@dlang.rocks> --- @pbackus created dlang/phobos pull request #8826 "Fix Issue 24165 - Failed readf leaves File in inconsistent state" fixing this issue: - Fix Issue 24165 - Failed readf leaves File in inconsistent state Previously, a failed call to readf resulted in multiple copies of the same LockingTextWriter being destroyed. Since LockingTextWriter's destructor calls ungetc on the last-read character, this caused that character to appear multiple times in subsequent reads from the File. This change ensures that the destructor in question is only run once by making LockingTextWriter a reference-counted type. Ideally, to avoid unnecessary overhead, this issue would have been fixed by making LockingTextWriter non-copyable. However, non-copyable ranges are poorly-supported by Phobos, and this approach would have required extensive changes to several other modules, including changes to the interfaces of some public symbols. https://github.com/dlang/phobos/pull/8826 -- |
Copyright © 1999-2021 by the D Language Foundation