Fix of recent GCode / GCodeProcessor refactoring: Don't close a FILE

twice.
This commit is contained in:
Vojtech Bubnik 2021-09-07 17:58:06 +02:00
parent 152e236dda
commit 0da0a7b2a0
2 changed files with 23 additions and 4 deletions
src/libslic3r/GCode

View file

@ -350,7 +350,12 @@ void GCodeProcessor::TimeProcessor::reset()
struct FilePtr {
FilePtr(FILE *f) : f(f) {}
~FilePtr() { this->close(); }
void close() { if (f) ::fclose(f); }
void close() {
if (this->f) {
::fclose(this->f);
this->f = nullptr;
}
}
FILE* f = nullptr;
};