From 7328f90e64ceb0dd6328b555f13ee4d9176f8510 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 5 Feb 2025 10:13:38 +0100 Subject: [PATCH] Linux: autodetect gdb (to add -nograb) even in release mode Application developers using Qt from their distribution, or from the official installer, get a release-mode Qt build, where QT_DEBUG wasn't defined. That's no reason to hit the issue that a breakpoint in code that gets hit when opening a popup menu should lead to a complete desktop freeze due to the mouse/keyboard grab. Change-Id: Idf0df03ce5afb792261b62cabb06fab17b5e2952 Reviewed-by: Liang Qi Reviewed-by: Friedemann Kleint (cherry picked from commit a176f87a6451412a632866fda1fd79290b9d7520) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 0371c1daecf..5066a079614 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -71,7 +71,7 @@ using namespace Qt::StringLiterals; // or, for older Linuxes, read out 'cmdline'. static bool runningUnderDebugger() { -#if defined(QT_DEBUG) && defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) const QString parentProc = "/proc/"_L1 + QString::number(getppid()); const QFileInfo parentProcExe(parentProc + "/exe"_L1); if (parentProcExe.isSymLink()) @@ -157,12 +157,10 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char doGrabArg = false; } -#if defined(QT_DEBUG) if (!noGrabArg && !doGrabArg && underDebugger) { qCDebug(lcQpaXcb, "Qt: gdb: -nograb added to command-line options.\n" "\t Use the -dograb option to enforce grabbing."); } -#endif m_canGrab = (!underDebugger && !noGrabArg) || (underDebugger && doGrabArg); static bool canNotGrabEnv = qEnvironmentVariableIsSet("QT_XCB_NO_GRAB_SERVER");