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.
This commit is contained in:
Cam Mannett
2024-06-19 17:02:04 +01:00
committed by Baldur Karlsson
parent a765ef025d
commit 381ece60c6
2 changed files with 18 additions and 2 deletions
+16 -2
View File
@@ -24,6 +24,7 @@
#include "LiveCapture.h"
#include <QDesktopServices>
#include <QHostInfo>
#include <QMenu>
#include <QMetaProperty>
#include <QMouseEvent>
@@ -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();
}
+2
View File
@@ -157,6 +157,8 @@ private:
bool checkAllowDelete();
void deleteCaptureUnprompted(QListWidgetItem *item);
bool isLocal() const;
Ui::LiveCapture *ui;
ICaptureContext &m_Ctx;
QString m_Hostname;