From e2f504e686fdce3fd7c5d150838e27614ca5c94c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 25 Sep 2015 07:57:43 -0400 Subject: [PATCH] Context: No longer calls Context methods while dtor is running. --- src/Context.cpp | 4 +++- src/TDB2.cpp | 4 +++- src/TDB2.h | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Context.cpp b/src/Context.cpp index cb4368187..62d879f73 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -622,7 +622,7 @@ void Context::getLimits (int& rows, int& lines) void Context::staticInitialization () { CLI2::minimumMatchLength = config.getInteger ("abbreviation.minimum"); - Lexer::minimumMatchLength = config.getInteger ("abbreviation.minimum"); + Lexer::minimumMatchLength = config.getInteger ("abbreviation.minimum"); Task::defaultProject = config.get ("default.project"); Task::defaultDue = config.get ("default.due"); @@ -632,6 +632,8 @@ void Context::staticInitialization () Lexer::dateFormat = Variant::dateFormat = config.get ("dateformat"); Lexer::isoEnabled = Variant::isoEnabled = config.getBoolean ("date.iso"); + TDB2::debug_mode = config.getBoolean ("debug"); + for (auto& rc : config) { if (rc.first.substr (0, 4) == "uda." && diff --git a/src/TDB2.cpp b/src/TDB2.cpp index 8351c370f..6a82f10f1 100644 --- a/src/TDB2.cpp +++ b/src/TDB2.cpp @@ -43,6 +43,8 @@ extern Context context; +bool TDB2::debug_mode = false; + //////////////////////////////////////////////////////////////////////////////// TF2::TF2 () : _read_only (false) @@ -57,7 +59,7 @@ TF2::TF2 () //////////////////////////////////////////////////////////////////////////////// TF2::~TF2 () { - if (_dirty && context.verbose ("debug")) + if (_dirty && TDB2::debug_mode) std::cout << format (STRING_TDB2_DIRTY_EXIT, std::string (_file)) << "\n"; } diff --git a/src/TDB2.h b/src/TDB2.h index 829a02a37..c72b0c528 100644 --- a/src/TDB2.h +++ b/src/TDB2.h @@ -103,6 +103,8 @@ private: class TDB2 { public: + static bool debug_mode; + TDB2 (); ~TDB2 ();