From 2e6ad629e3e28f9486f93b0c826ea625781a6941 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Wed, 23 Oct 2019 23:11:12 +0200 Subject: [PATCH] riff: flush file after chunk manipulations --- mutagen/_riff.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mutagen/_riff.py b/mutagen/_riff.py index 269da4a7..e2a7ae66 100644 --- a/mutagen/_riff.py +++ b/mutagen/_riff.py @@ -125,6 +125,7 @@ def delete(self): delete_bytes(self._fileobj, self.size, self.offset) if self.parent_chunk is not None: self.parent_chunk._remove_subchunk(self) + self._fileobj.flush() def _update_size(self, size_diff, changed_subchunk=None): """Update the size of the chunk""" @@ -153,6 +154,7 @@ def resize(self, new_data_size): new_data_size + padding, self.data_offset) size_diff = new_data_size - self.data_size self._update_size(size_diff) + self._fileobj.flush() def padding(self): """Returns the number of padding bytes (0 or 1). @@ -231,6 +233,7 @@ def insert_chunk(self, id_, data=None): if data: chunk.write(data) self.subchunks().append(chunk) + self._fileobj.flush() return chunk def _remove_subchunk(self, chunk):