From 381ece60c69da999ebb170b4de563ee0ee0dfe2b Mon Sep 17 00:00:00 2001 From: Cam Mannett Date: Wed, 19 Jun 2024 17:02:04 +0100 Subject: [PATCH] Non-local child removal fix The frontend compares the registered child PIDs against the locally running ones, any that aren't in the list are removed - this is how dead procs are removed. Unfortunately this causes any children from a remote context to be immediately removed. After discussion with upstream, the agreed solution was to prevent child removal entirely for remote contexts as long as clicking on dead children does nothing. --- qrenderdoc/Windows/Dialogs/LiveCapture.cpp | 18 ++++++++++++++++-- qrenderdoc/Windows/Dialogs/LiveCapture.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index c49f9def5..36154c332 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -24,6 +24,7 @@ #include "LiveCapture.h" #include +#include #include #include #include @@ -448,8 +449,15 @@ void LiveCapture::childUpdate() } } + // We only compare the child processes for a local context + const bool local = isLocal(); + // enumerate processes outside of the lock - QProcessList processes = QProcessInfo::enumerate(false); + QProcessList processes; + if(local) + { + processes = QProcessInfo::enumerate(false); + } // now since we're adding and removing, we lock around the whole rest of the function. It won't be // too slow. @@ -472,7 +480,7 @@ void LiveCapture::childUpdate() } } - if(!found) + if(!found && local) { if(m_Children[i].added) { @@ -1460,3 +1468,9 @@ void LiveCapture::connectionThreadEntry() connectionClosed(); }); } + +bool LiveCapture::isLocal() const +{ + return m_Hostname.isEmpty() || QHostInfo::localHostName() == m_Hostname || + QLatin1String("0.0.0.0") == m_Hostname || QHostAddress(m_Hostname).isLoopback(); +} diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.h b/qrenderdoc/Windows/Dialogs/LiveCapture.h index 8a23beb66..87ef2e343 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.h +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.h @@ -157,6 +157,8 @@ private: bool checkAllowDelete(); void deleteCaptureUnprompted(QListWidgetItem *item); + bool isLocal() const; + Ui::LiveCapture *ui; ICaptureContext &m_Ctx; QString m_Hostname;