[plugins/virtualmonitor] Fix crash when krfb-virtualmonitor fails all retries

After enough retries we give up and delete the QProcess

However we later access it again to print its output

Move that before the deletion

BUG: 464241
(cherry picked from commit b34a0a8f29)
This commit is contained in:
Nicolas Fella 2023-01-20 13:28:28 +01:00
parent 23098c8544
commit 87686bf5be

View file

@ -115,6 +115,8 @@ bool VirtualMonitorPlugin::requestVirtualMonitor()
QS("--port"),
port});
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, [this](int exitCode, QProcess::ExitStatus exitStatus) {
qCWarning(KDECONNECT_PLUGIN_VIRTUALMONITOR) << "virtual display finished with" << device()->name() << m_process->readAllStandardError();
if (m_retries < 5 && (exitCode == 1 || exitStatus == QProcess::CrashExit)) {
m_retries++;
requestVirtualMonitor();
@ -122,7 +124,6 @@ bool VirtualMonitorPlugin::requestVirtualMonitor()
m_process->deleteLater();
m_process = nullptr;
}
qCWarning(KDECONNECT_PLUGIN_VIRTUALMONITOR) << "virtual display finished with" << device()->name() << m_process->readAllStandardError();
});
m_process->start();