mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Unregister shortcuts when closing windows that registered shortcuts
* This prevents leaking for cases where new widgets are created (and the small chance a widget pointer could be re-used and cause serious problems), and multiple-registration errors for global shortcuts.
This commit is contained in:
@@ -165,6 +165,26 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent)
|
||||
|
||||
EventBrowser::~EventBrowser()
|
||||
{
|
||||
// unregister any shortcuts we registered
|
||||
Qt::Key keys[] = {
|
||||
Qt::Key_1, Qt::Key_2, Qt::Key_3, Qt::Key_4, Qt::Key_5,
|
||||
Qt::Key_6, Qt::Key_7, Qt::Key_8, Qt::Key_9, Qt::Key_0,
|
||||
};
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
m_Ctx.GetMainWindow()->UnregisterShortcut(
|
||||
QKeySequence(keys[i] | Qt::ControlModifier).toString(), NULL);
|
||||
}
|
||||
|
||||
m_Ctx.GetMainWindow()->UnregisterShortcut(
|
||||
QKeySequence(Qt::Key_Left | Qt::ControlModifier).toString(), NULL);
|
||||
|
||||
m_Ctx.GetMainWindow()->UnregisterShortcut(
|
||||
QKeySequence(Qt::Key_Right | Qt::ControlModifier).toString(), NULL);
|
||||
|
||||
m_Ctx.GetMainWindow()->UnregisterShortcut(QString(), ui->findStrip);
|
||||
m_Ctx.GetMainWindow()->UnregisterShortcut(QString(), ui->jumpStrip);
|
||||
|
||||
m_Ctx.BuiltinWindowClosed(this);
|
||||
m_Ctx.RemoveCaptureViewer(this);
|
||||
delete ui;
|
||||
|
||||
Reference in New Issue
Block a user