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:
baldurk
2017-11-22 16:07:14 +00:00
parent cadc0f3855
commit 38acc56084
5 changed files with 68 additions and 1 deletions
+3
View File
@@ -585,6 +585,9 @@ ShaderViewer::~ShaderViewer()
// don't want to async invoke while using 'this', so save the trace separately
ShaderDebugTrace *trace = m_Trace;
// unregister any shortcuts on this window
m_Ctx.GetMainWindow()->UnregisterShortcut(QString(), this);
m_Ctx.Replay().AsyncInvoke([trace](IReplayController *r) { r->FreeTrace(trace); });
if(m_CloseCallback)