From 0a9a7d262fcd9e796c3b99e66636c093ed46fd33 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 24 Dec 2015 00:19:39 +0000 Subject: Catch exceptions during destruction of BackupStoreCheck as well. Like HousekeepStoreAccount, throwing an exception during the destructor will terminate the application in an "unusual way". --- lib/backupstore/BackupStoreCheck.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib/backupstore') diff --git a/lib/backupstore/BackupStoreCheck.cpp b/lib/backupstore/BackupStoreCheck.cpp index bef23f3f..b53ebf6d 100644 --- a/lib/backupstore/BackupStoreCheck.cpp +++ b/lib/backupstore/BackupStoreCheck.cpp @@ -84,7 +84,18 @@ BackupStoreCheck::~BackupStoreCheck() // Avoid an exception if we forget to discard mapNewRefs 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("Error while destroying BackupStoreCheck: discarding " + "the refcount database threw an exception: " << e.what()); + } + mapNewRefs.reset(); } } -- cgit v1.2.3