Skip to content

Commit a59e0a8

Browse files
committed
dap: process input events while paused to prevent deadlocks
1 parent 9a0b864 commit a59e0a8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/common/scripting/dap/DebugExecutionManager.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include <thread>
33
// #include "Window.h"
44
#include "GameInterfaces.h"
5+
#include "common/engine/g_input.h"
6+
57
namespace DebugServer
68
{
79
// using namespace RE::BSScript::Internal;
@@ -148,15 +150,15 @@ void DebugExecutionManager::WaitWhilePaused(pauseReason pauseReason, VMFrameStac
148150
{
149151
while (m_state == DebuggerState::kPaused)
150152
{
153+
// TODO: we have to process window events so that we prevent deadlocks when the debug extension sets this window to foreground,
154+
// but this also processes input events; ideally, we'd only process the window events.
155+
I_GetEvent();
151156
using namespace std::chrono_literals;
152157
std::this_thread::sleep_for(100ms);
153158
}
154159
}
155160
std::lock_guard<std::mutex> lock(m_instructionMutex);
156-
// If we were the thread that paused, regain focus
157-
// TODO: How to do this in GZDoom?
158-
// Window::RegainFocus();
159-
// also reset the state
161+
// reset the state
160162
m_runtimeState->Reset();
161163
if (m_state != DebuggerState::kRunning && stack)
162164
{

0 commit comments

Comments
 (0)