Call OnCaptureClosed for capture viewers before resetting capture info

This commit is contained in:
baldurk
2026-08-13 17:46:45 +01:00
parent cd79225daa
commit 567b0228aa
4 changed files with 22 additions and 33 deletions
+8 -8
View File
@@ -1443,6 +1443,14 @@ void CaptureContext::CloseCapture()
if(!m_CaptureLoaded)
return;
rdcarray<ICaptureViewer *> capviewers(m_CaptureViewers);
for(ICaptureViewer *viewer : capviewers)
{
if(viewer && m_CaptureViewers.contains(viewer))
viewer->OnCaptureClosed();
}
delete m_Watcher;
m_Watcher = NULL;
@@ -1487,14 +1495,6 @@ void CaptureContext::CloseCapture()
m_CaptureLoaded = false;
rdcarray<ICaptureViewer *> capviewers(m_CaptureViewers);
for(ICaptureViewer *viewer : capviewers)
{
if(viewer && m_CaptureViewers.contains(viewer))
viewer->OnCaptureClosed();
}
m_Replay.CloseThread();
}
+1 -1
View File
@@ -408,7 +408,7 @@ void LiveCapture::deleteCapture_triggered()
if(cap->path == m_Ctx.GetCaptureFilename())
{
m_Main->takeCaptureOwnership();
m_Main->CloseCapture();
m_Ctx.CloseCapture();
}
else
{
+13 -23
View File
@@ -1208,7 +1208,7 @@ bool MainWindow::PromptCloseCapture()
}
}
CloseCapture();
m_Ctx.CloseCapture();
if(!deletepath.isEmpty())
{
@@ -1219,31 +1219,11 @@ bool MainWindow::PromptCloseCapture()
return true;
}
void MainWindow::CloseCapture()
{
QString path = m_Ctx.GetCaptureFilename();
bool local = m_Ctx.IsCaptureLocal();
bool temp = m_Ctx.IsCaptureTemporary();
m_Ctx.CloseCapture();
if(m_OwnTempCapture && temp)
{
m_Ctx.Replay().DeleteCapture(path, local);
RemoveRecentCapture(path);
m_OwnTempCapture = false;
}
ui->action_Save_Capture_Inplace->setEnabled(false);
ui->action_Save_Capture_As->setEnabled(false);
ui->menu_Export_As->setEnabled(false);
}
void MainWindow::SetTitle(const QString &filename)
{
QString prefix;
if(m_Ctx.IsCaptureLoaded())
if(m_Ctx.IsCaptureLoaded() && !filename.isEmpty())
{
prefix = QFileInfo(filename).fileName();
if(m_Ctx.APIProps().degraded)
@@ -2363,6 +2343,16 @@ void MainWindow::OnCaptureLoaded()
void MainWindow::OnCaptureClosed()
{
if(m_OwnTempCapture && m_Ctx.IsCaptureTemporary())
{
QString path = m_Ctx.GetCaptureFilename();
m_Ctx.Replay().DeleteCapture(path, m_Ctx.IsCaptureLocal());
RemoveRecentCapture(path);
}
m_OwnTempCapture = false;
ui->action_Save_Capture_Inplace->setEnabled(false);
ui->action_Save_Capture_As->setEnabled(false);
ui->action_Close_Capture->setEnabled(false);
@@ -2385,7 +2375,7 @@ void MainWindow::OnCaptureClosed()
ui->action_EmbedExternalFiles->setEnabled(false);
ui->action_RemoveExternalFiles->setEnabled(false);
SetTitle();
SetTitle(QString());
// if the remote sever disconnected during capture replay, resort back to a 'disconnected' state
if(m_Ctx.Replay().CurrentRemote().IsValid() && !m_Ctx.Replay().CurrentRemote().IsServerRunning())
-1
View File
@@ -106,7 +106,6 @@ public:
void captureModified();
void LoadFromFilename(const QString &filename, bool temporary);
void LoadCapture(const QString &filename, const ReplayOptions &opts, bool temporary, bool local);
void CloseCapture();
QString GetSavePath(QString title = QString(), QString filter = QString());
void OnCaptureTrigger(const QString &exe, const QString &workingDir, const QString &cmdLine,