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.
This commit is contained in:
Thomas Goyne 2016-01-02 13:46:40 -08:00
parent 0b2d0d40d5
commit 9b815ac8cc

View file

@ -369,7 +369,12 @@ int AegisubApp::OnExit() {
agi::Context& AegisubApp::NewProjectContext() { agi::Context& AegisubApp::NewProjectContext() {
auto frame = new FrameMain; 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)); frames.erase(remove(begin(frames), end(frames), frame), end(frames));
if (frames.empty()) { if (frames.empty()) {
ExitMainLoop(); ExitMainLoop();