diff options
author | bubnikv <bubnikv@gmail.com> | 2017-12-05 20:40:46 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-12-05 20:40:46 +0300 |
commit | 7892dfd53c083f7b5c26dad04dca0f84ab29b2a7 (patch) | |
tree | 9918eb13819ae9e0dd335135384532e48e742066 /xs/src/libslic3r/GCode.cpp | |
parent | 0a2be9d7bf22faba489a1a66c4a3ebbcdca87cba (diff) |
Fixed a regression bug in G-code export, where ferror was called on
released FILE structure.
Diffstat (limited to 'xs/src/libslic3r/GCode.cpp')
-rw-r--r-- | xs/src/libslic3r/GCode.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp index 131693b4e..528d7132b 100644 --- a/xs/src/libslic3r/GCode.cpp +++ b/xs/src/libslic3r/GCode.cpp @@ -376,11 +376,13 @@ void GCode::do_export(Print *print, const char *path) this->m_placeholder_parser_failed_templates.clear(); this->_do_export(*print, file); - fclose(file); + fflush(file); if (ferror(file)) { + fclose(file); boost::nowide::remove(path_tmp.c_str()); throw std::runtime_error(std::string("G-code export to ") + path + " failed\nIs the disk full?\n"); } + fclose(file); if (! this->m_placeholder_parser_failed_templates.empty()) { // G-code export proceeded, but some of the PlaceholderParser substitutions failed. std::string msg = std::string("G-code export to ") + path + " failed due to invalid custom G-code sections:\n\n"; |