From 9b815ac8ccba0cffd0e6aed417c85bf2245722e1 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sat, 2 Jan 2016 13:46:40 -0800 Subject: [PATCH] Fix a crash when reattaching video The window close event propagates up to the detached window's parent, so the handler for the parent window closing needs to filter it out. --- src/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 7227d0877..e56e3a437 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -369,7 +369,12 @@ int AegisubApp::OnExit() { agi::Context& AegisubApp::NewProjectContext() { auto frame = new FrameMain; - frame->Bind(wxEVT_DESTROY, [=](wxWindowDestroyEvent&) { + frame->Bind(wxEVT_DESTROY, [=](wxWindowDestroyEvent& evt) { + if (evt.GetWindow() != frame) { + evt.Skip(); + return; + } + frames.erase(remove(begin(frames), end(frames), frame), end(frames)); if (frames.empty()) { ExitMainLoop();