avoid using ifstream deleted copy constructor, supported by many but no all compilers

This commit is contained in:
Jean-Francois Dockes 2021-08-03 10:04:05 +02:00
parent b77ca3fe56
commit 03e277c0c9

View File

@ -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;