Commit f5a161dc authored by Paal Kvamme's avatar Paal Kvamme
Browse files

User opt-in for the readonly kludge. Route dataset close via a single function.

parent c5b87288
......@@ -801,8 +801,8 @@ public:
// TODO-Low: Maybe not if the file isn't finalized?
victim->setReadonlyMode(true);
break;
default:
break;
default:
break;
}
victim->close();
victim.reset(); // Any throw from SDGenericDataset dtor happens here.
......@@ -1077,19 +1077,12 @@ SDGenericDatasetWrapper::~SDGenericDatasetWrapper()
// Hopefully the destructors won't try to close again when they see
// that we tried to do so ourselves. Note: currently they will try that.
if (dataset_)
dataset_->close();
wrapper_close();
}
catch (const std::exception& ex) {
if (std::string(ex.what()).find("dataset is not open") == std::string::npos)
this->logger_(0, "SDGenericDataset::close(): " + std::string(ex.what()));
}
try {
// Catch exceptions raised inside a destructor might not work. But I tried.
dataset_.reset();
}
catch (const std::exception& ex) {
this->logger_(0, "SDGenericDataset::dtor(): " + std::string(ex.what()));
}
manager_.reset();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment