diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -932,9 +932,12 @@ } std::string strCmd = gArgs.GetArg("-blocknotify", ""); - - boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); - boost::thread t(runCommand, strCmd); // thread runs free + if (!strCmd.empty()) { + boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex()); + std::thread t(runCommand, strCmd); + // thread runs free + t.detach(); + } } static bool fHaveGenesis = false; diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -45,13 +45,13 @@ #include #include +#include #include #include #include #include #include -#include #if defined(NDEBUG) #error "Bitcoin cannot be compiled without assertions." @@ -947,8 +947,9 @@ safeStatus = singleQuote + safeStatus + singleQuote; boost::replace_all(strCmd, "%s", safeStatus); + std::thread t(runCommand, strCmd); // thread runs free - boost::thread t(runCommand, strCmd); + t.detach(); } static void CheckForkWarningConditions() { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -33,7 +33,6 @@ #include "wallet/finaltx.h" #include -#include #include @@ -1081,8 +1080,9 @@ if (!strCmd.empty()) { boost::replace_all(strCmd, "%s", wtxIn.GetId().GetHex()); + std::thread t(runCommand, strCmd); // Thread runs free. - boost::thread t(runCommand, strCmd); + t.detach(); } return true;