From 90eb027204f5a9d7c00fa97d4112243bd37a9012 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 22 May 2020 15:45:21 +0300 Subject: [PATCH] doc: Add and fix comments about never destroyed objects --- src/logging.cpp | 4 ++-- src/sync.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/logging.cpp b/src/logging.cpp index eb9da06d9ba..56c44ae1ea4 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -22,8 +22,8 @@ BCLog::Logger& LogInstance() * access the logger. When the shutdown sequence is fully audited and tested, * explicit destruction of these objects can be implemented by changing this * from a raw pointer to a std::unique_ptr. - * Since the destructor is never called, the logger and all its members must - * have a trivial destructor. + * Since the ~Logger() destructor is never called, the Logger class and all + * its subclasses must have implicitly-defined destructors. * * This method of initialization was originally introduced in * ee3374234c60aba2cc4c5cd5cac1c0aefc2d817c. diff --git a/src/sync.cpp b/src/sync.cpp index 9b0878bbea2..c3312b5a00e 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -95,6 +95,8 @@ struct LockData { LockData& GetLockData() { // This approach guarantees that the object is not destroyed until after its last use. // The operating system automatically reclaims all the memory in a program's heap when that program exits. + // Since the ~LockData() destructor is never called, the LockData class and all + // its subclasses must have implicitly-defined destructors. static LockData& lock_data = *new LockData(); return lock_data; }