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):