diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index a04a1a088..6446d83ef 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -1443,6 +1443,14 @@ void CaptureContext::CloseCapture() if(!m_CaptureLoaded) return; + rdcarray 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 capviewers(m_CaptureViewers); - - for(ICaptureViewer *viewer : capviewers) - { - if(viewer && m_CaptureViewers.contains(viewer)) - viewer->OnCaptureClosed(); - } - m_Replay.CloseThread(); } diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index aa10e78fa..d33a36044 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -408,7 +408,7 @@ void LiveCapture::deleteCapture_triggered() if(cap->path == m_Ctx.GetCaptureFilename()) { m_Main->takeCaptureOwnership(); - m_Main->CloseCapture(); + m_Ctx.CloseCapture(); } else { diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 9b4e01e0b..a02eb198f 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -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()) diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index 0b09776b1..205b534f6 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -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,