Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually don't dispose hawkfile stream after ReadAllBytes()
fixes a30c0ef
- Loading branch information
6336818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're re-using it now, don't you need to
Seek
?6336818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (or set Position to 0), although that is the same pattern our ReadAllBytes() Stream extension does (relying on caller). RomGame callsite sets Position to 0 beforehand.
6336818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow, this isn't using
Stream.ReadAllBytes
, and neither isRomGame
(for the rom at least).6336818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream.ReadAllBytes
has the pattern of also relying on caller to set Position correctly, just likeHawkFile.ReadAllBytes
does (stupid but didn't want to bother fixing it everywhere since everywhere obeys it).The one callsite which this matters for HawkFiles, in RomGame, does set 0 for Position
BizHawk/src/BizHawk.Client.Common/RomGame.cs
Lines 96 to 97 in 6336818
(edit: realizing this is not ReadAllBytes, it's just regular read, I'm dumb)
6336818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with c5a4ec9.