Skip to content

Commit

Permalink
Don't flush in JSONIOHandlerImpl destructor
Browse files Browse the repository at this point in the history
It's not needed, and it avoids weird situations while recovering from an
error.
  • Loading branch information
franzpoeschel committed Apr 11, 2023
1 parent 92d1b0f commit bf682ba
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/IO/JSON/JSONIOHandlerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,7 @@ JSONIOHandlerImpl::JSONIOHandlerImpl(AbstractIOHandler *handler)
: AbstractIOHandlerImpl(handler)
{}

JSONIOHandlerImpl::~JSONIOHandlerImpl()
{
// we must not throw in a destructor
try
{
flush();
}
catch (std::exception const &ex)
{
std::cerr << "[~JSONIOHandlerImpl] An error occurred: " << ex.what()
<< std::endl;
}
catch (...)
{
std::cerr << "[~JSONIOHandlerImpl] An error occurred." << std::endl;
}
}
JSONIOHandlerImpl::~JSONIOHandlerImpl() = default;

std::future<void> JSONIOHandlerImpl::flush()
{
Expand Down

0 comments on commit bf682ba

Please sign in to comment.