[Issue 24165] Failed readf leaves File in inconsistent state
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Oct 14 23:49:27 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24165
Dlang Bot <dlang-bot at dlang.rocks> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |pull
--- Comment #1 from Dlang Bot <dlang-bot at 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
--
More information about the Digitalmars-d-bugs
mailing list