mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Fix for SPE-688 (crash when saving zip to low disk space)
This commit is contained in:
parent
dd3c485965
commit
a16e419138
2 changed files with 22 additions and 5 deletions
|
@ -113,10 +113,17 @@ public:
|
|||
zipstream(zipfile),
|
||||
pngstream(zipstream)
|
||||
{
|
||||
if(!zipfile.IsOk())
|
||||
if(!is_ok())
|
||||
throw std::runtime_error("Cannot create zip file.");
|
||||
}
|
||||
|
||||
~LayerWriter() {
|
||||
// In case of an error (disk space full) zipstream destructor would
|
||||
// crash.
|
||||
pngstream.clear();
|
||||
zipstream.CloseEntry();
|
||||
}
|
||||
|
||||
inline void next_entry(const std::string& fname) {
|
||||
zipstream.PutNextEntry(fname);
|
||||
}
|
||||
|
@ -129,6 +136,10 @@ public:
|
|||
pngstream << arg; return *this;
|
||||
}
|
||||
|
||||
bool is_ok() const {
|
||||
return pngstream.good() && zipstream.IsOk() && zipfile.IsOk();
|
||||
}
|
||||
|
||||
inline void close() {
|
||||
zipstream.Close();
|
||||
zipfile.Close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue