From 9fe5ca33fab20454950dac40d6d9fe8fd54f10f1 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Thu, 16 Oct 2025 03:39:45 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkgui Synchronize source files from linuxdeepin/dtkgui. Source-pull-request: https://github.com/linuxdeepin/dtkgui/pull/346 --- src/kernel/dguiapplicationhelper.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kernel/dguiapplicationhelper.cpp b/src/kernel/dguiapplicationhelper.cpp index 03298c3..10e758f 100644 --- a/src/kernel/dguiapplicationhelper.cpp +++ b/src/kernel/dguiapplicationhelper.cpp @@ -1502,11 +1502,6 @@ bool DGuiApplicationHelper::setSingleInstance(const QString &key, DGuiApplicatio } socket_key += key; - QString lockfile = socket_key; - if (!lockfile.startsWith(QLatin1Char('/'))) { - lockfile = QDir::cleanPath(QDir::tempPath()); - lockfile += QLatin1Char('/') + socket_key; - } #ifdef Q_OS_LINUX auto info = QFileInfo{"/proc/self/ns/pid"}; @@ -1527,11 +1522,17 @@ bool DGuiApplicationHelper::setSingleInstance(const QString &key, DGuiApplicatio auto num = pidns.mid(start + 1, end - start - 1); // append pid namespace - lockfile += QStringLiteral("_%1").arg(num); + socket_key += QStringLiteral("_%1").arg(num); break; } #endif + QString lockfile = socket_key; + if (!lockfile.startsWith(QLatin1Char('/'))) { + lockfile = QDir::cleanPath(QDir::tempPath()); + lockfile += QLatin1Char('/') + socket_key; + } + lockfile += QStringLiteral(".lock"); static QScopedPointer lock(new QLockFile(lockfile)); // 同一个进程多次调用本接口使用最后一次设置的 key