From 0b509d458b2ef3c5c525b7e5e2e66352285c7d91 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 22 Dec 2015 21:24:16 +0000 Subject: Catch and log exceptions in the HousekeepStoreAccount destructor. Destructors aren't supposed to throw exceptions, and they can be called while cleaning up from a previous exception, which will terminate the application, so just log the error and carry on. --- lib/backupstore/HousekeepStoreAccount.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/backupstore/HousekeepStoreAccount.cpp b/lib/backupstore/HousekeepStoreAccount.cpp index e5bd3cbb..c965dd17 100644 --- a/lib/backupstore/HousekeepStoreAccount.cpp +++ b/lib/backupstore/HousekeepStoreAccount.cpp @@ -81,7 +81,17 @@ HousekeepStoreAccount::~HousekeepStoreAccount() { if(mapNewRefs.get()) { - mapNewRefs->Discard(); + // Discard() can throw exception, but destructors aren't supposed to do that, so + // just catch and log them. + try + { + mapNewRefs->Discard(); + } + catch(BoxException &e) + { + BOX_ERROR("Failed to destroy housekeeper: discarding the refcount " + "database threw an exception: " << e.what()); + } } } -- cgit v1.2.3