From 03e277c0c952b12d0252bcf8bcf3ecf0d19e8e38 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 3 Aug 2021 10:04:05 +0200 Subject: [PATCH] avoid using ifstream deleted copy constructor, supported by many but no all compilers --- src/internfile/mh_mbox.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp index 2a0918cf..495284fc 100644 --- a/src/internfile/mh_mbox.cpp +++ b/src/internfile/mh_mbox.cpp @@ -321,7 +321,14 @@ void MimeHandlerMbox::clear_impl() { m->fn.erase(); m->ipath.erase(); - m->instream = ifstream(); + + // We used to use m->instream = ifstream() which fails with some compilers, as the copy + // constructor is marked deleted in standard c++ (works with many compilers though). + if (m->instream.is_open()) { + m->instream.close(); + } + m->instream.clear(); + m->msgnum = 0; m->lineno = 0; m->fsize = 0;