diff --git a/Core/ClientSML/src/sml_ClientAgent.cpp b/Core/ClientSML/src/sml_ClientAgent.cpp index 4054082a78..1188e80812 100644 --- a/Core/ClientSML/src/sml_ClientAgent.cpp +++ b/Core/ClientSML/src/sml_ClientAgent.cpp @@ -145,14 +145,14 @@ Agent::Agent(Kernel* pKernel, char const* pName) m_WorkingMemory.SetAgent(this) ; - m_pDPI = 0; + m_pDPI = nullptr; ClearError() ; } Agent::~Agent() { - KillDebugger(); + KillDebugger(true); } Connection* Agent::GetConnection() const @@ -1839,11 +1839,14 @@ bool Agent::SpawnDebugger(int port, const char* jarpath) #endif // _WIN32 } -bool Agent::KillDebugger() +bool Agent::KillDebugger(bool ignoreNonExistent) { if (!m_pDPI) { - std::cerr << "KillDebugger: No existing debugger process information" << std::endl; + if (!ignoreNonExistent) + { + std::cerr << "KillDebugger: No existing debugger process information" << std::endl; + } return false; } bool successful = false; @@ -1877,7 +1880,7 @@ void Agent::ClearDebuggerProcessInformation() if (m_pDPI) { delete m_pDPI; - m_pDPI = 0; + m_pDPI = nullptr; } } diff --git a/Core/ClientSML/src/sml_ClientAgent.h b/Core/ClientSML/src/sml_ClientAgent.h index e8b3f25b59..f745d5f887 100644 --- a/Core/ClientSML/src/sml_ClientAgent.h +++ b/Core/ClientSML/src/sml_ClientAgent.h @@ -884,8 +884,14 @@ namespace sml * @brief Kills the previously spawned debugger. Returns false * if the debugger was never spawned or an OS issue occurs * while killing the process. - *************************************************************/ - bool KillDebugger(); + * @param ignoreNonExistent if true, do not print a warning if + * no debugger process exists to kill. This is useful, for example, + * when the client doesn't know if the debugger was ever actually + * opened, or whether the user may have closed the window, but wants + * to close it just in case for cleanup purposes. Not currently + * exposed via SWIG bindings. + *************************************************************/ + bool KillDebugger(bool ignoreNonExistent = false); /************************************************************* * @brief Convert a client-side identifier string to kernel-side.