From 070a3a30b60bea1c7d14a5bd1a5e5f5aa00bcaf3 Mon Sep 17 00:00:00 2001 From: Robert MacGregor Date: Wed, 6 Oct 2021 00:35:38 -0400 Subject: [PATCH] * [Linux] BugFix: Free the mouse cursor when triggering SIGTRAP on Linux to ensure that the cursor is available for debugging. --- .../source/platformX86UNIX/x86UNIXProcessControl.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp index 09c59af4d..db7d0bdb7 100644 --- a/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp +++ b/Engine/source/platformX86UNIX/x86UNIXProcessControl.cpp @@ -24,6 +24,8 @@ #include "platformX86UNIX/x86UNIXState.h" #include "platformX86UNIX/x86UNIXStdConsole.h" #include "platform/platformInput.h" +#include "windowManager/platformWindow.h" +#include "windowManager/platformWindowMgr.h" #include "console/console.h" #include @@ -165,6 +167,15 @@ void Platform::debugBreak() Con::errorf(ConsoleLogEntry::General, "Platform::debugBreak: triggering SIGSEGV for core dump"); //kill(getpid(), SIGSEGV); + + // On Linux, the mouse cursor will remain trapped when the SIGTRAP below triggers so we ensure the mouse + // locked state is disabled prior to dropping to debug + PlatformWindow* firstWindow = WindowManager->getFirstWindow(); + if (firstWindow) + { + firstWindow->setMouseLocked(false); + } + kill(getpid(), SIGTRAP); }