Don't close the live capture while a menu might still be open.

This commit is contained in:
baldurk
2017-06-20 10:46:18 +01:00
parent 628e6481d5
commit b930b255c9
2 changed files with 27 additions and 2 deletions
+22 -2
View File
@@ -239,7 +239,9 @@ void LiveCapture::on_captures_mouseClicked(QMouseEvent *e)
QObject::connect(&contextDeleteAction, &QAction::triggered, this,
&LiveCapture::deleteCapture_triggered);
m_ContextMenu = &contextMenu;
RDDialog::show(&contextMenu, QCursor::pos());
m_ContextMenu = NULL;
}
}
@@ -961,7 +963,7 @@ void LiveCapture::connectionClosed()
// then don't close just yet.
if(ui->captures->count() == 1 || m_Children.count() == 0)
{
ToolWindowManager::closeToolWindow(this);
selfClose();
return;
}
@@ -973,12 +975,30 @@ void LiveCapture::connectionClosed()
LiveCapture *live =
new LiveCapture(m_Ctx, m_Hostname, m_HostFriendlyname, m_Children[0].ident, m_Main);
m_Main->ShowLiveCapture(live);
ToolWindowManager::closeToolWindow(this);
selfClose();
return;
}
}
}
void LiveCapture::selfClose()
{
if(m_ContextMenu)
{
qInfo() << "preventing race";
// hide the menu and close our window shortly after
m_ContextMenu->close();
QTimer *timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, [this]() { ToolWindowManager::closeToolWindow(this); });
timer->setSingleShot(true);
timer->start(250);
}
else
{
ToolWindowManager::closeToolWindow(this);
}
}
void LiveCapture::connectionThreadEntry()
{
m_Connection = RENDERDOC_CreateTargetControl(m_Hostname.toUtf8().data(), m_RemoteIdent,
+5
View File
@@ -125,6 +125,9 @@ private:
const rdctype::array<byte> &thumbnail, int32_t thumbWidth, int32_t thumbHeight,
QDateTime timestamp, const QString &path, bool local);
void connectionClosed();
void selfClose();
void killThread();
void setTitle(const QString &title);
@@ -157,6 +160,8 @@ private:
bool m_IgnoreThreadClosed = false;
bool m_IgnorePreviewToggle = false;
QMenu *m_ContextMenu = NULL;
QAction *previewToggle;
QToolButton *openButton;
QAction *newWindowAction;