diff options
author | Ben McMorran <bemcmorr@microsoft.com> | 2023-06-29 16:10:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-06-29 17:25:51 (GMT) |
commit | 764258771afb92067dd4b2c044d8d19abc6f932c (patch) | |
tree | 9f54476173cf01208690ded4d9cc6f3ccad729fb /Source | |
parent | 7952e114668e97c207a6fc210184765f052d033b (diff) | |
download | CMake-764258771afb92067dd4b2c044d8d19abc6f932c.zip CMake-764258771afb92067dd4b2c044d8d19abc6f932c.tar.gz CMake-764258771afb92067dd4b2c044d8d19abc6f932c.tar.bz2 |
Debugger: Fix threads request segfault after thread exited event
Fixes: #25041
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDebuggerAdapter.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmDebuggerAdapter.cxx b/Source/cmDebuggerAdapter.cxx index d03f79d..c2e0d4f 100644 --- a/Source/cmDebuggerAdapter.cxx +++ b/Source/cmDebuggerAdapter.cxx @@ -167,10 +167,16 @@ cmDebuggerAdapter::cmDebuggerAdapter( (void)req; std::unique_lock<std::mutex> lock(Mutex); dap::ThreadsResponse response; - dap::Thread thread; - thread.id = DefaultThread->GetId(); - thread.name = DefaultThread->GetName(); - response.threads.push_back(thread); + + // If a client requests threads during shutdown (like after receiving the + // thread exited event), DefaultThread won't be set. + if (DefaultThread) { + dap::Thread thread; + thread.id = DefaultThread->GetId(); + thread.name = DefaultThread->GetName(); + response.threads.push_back(thread); + } + return response; }); |