From 0ece6669c56af62f181b6ee57d12978b27a3634b Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Mon, 13 Jan 2025 13:38:16 +0100 Subject: [PATCH] fix thread-safety issue for logging singleton --- src/delta_utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/delta_utils.cpp b/src/delta_utils.cpp index f76c6e3..9cf8337 100644 --- a/src/delta_utils.cpp +++ b/src/delta_utils.cpp @@ -638,7 +638,9 @@ uintptr_t PredicateVisitor::VisitFilter(const string &col_name, const TableFilte void LoggerCallback::Initialize(DatabaseInstance &db_p) { auto &instance = GetInstance(); unique_lock lck(instance.lock); - instance.db = db_p.shared_from_this(); + if (instance.db.expired()) { + instance.db = db_p.shared_from_this(); + } } void LoggerCallback::CallbackEvent(ffi::Event event) {