diff --git a/NEWS.md b/NEWS.md index 56617d32b..e915f6f21 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,8 @@ ## Bug fixes +* mkvmerge: fixed that the error message "not enough space on disk" was shown + twice on some operating systems. Fixes #1850. * mkvmerge, Matroska: if a codec delay is set for a track in the input file, it is kept. Fixes #1849. * GUI: multiplexer: changing default values in the prerefences (e.g. the diff --git a/src/merge/output_control.cpp b/src/merge/output_control.cpp index 8d20536ea..4600d3db1 100644 --- a/src/merge/output_control.cpp +++ b/src/merge/output_control.cpp @@ -264,6 +264,10 @@ sighandler(int /* signum */) { mxinfo(Y(" done\n")); + // Manually close s_out because cleanup() will discard any remaining + // write buffer content in s_out. + s_out->close(); + cleanup(); mxerror(Y("mkvmerge was interrupted by a SIGINT (Ctrl+C?)\n")); @@ -2090,7 +2094,18 @@ destroy_readers() { */ void cleanup() { - s_out.reset(); + if (s_out) { + // If cleanup was called as a result of an exception during + // writing due to the file system being full, the destructor would + // normally write remaining buffered before closing the file. This + // would lead to another exception and another error + // message. However, the regular paths all close the file + // manually. Therefore any buffered content remaining at this + // point can only be due to an error having occurred. The content + // can therefore be discarded. + dynamic_cast(*s_out).discard_buffer(); + s_out.reset(); + } g_cluster_helper.reset();