X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7561aacd5e3bcd5f98f4cdadcec5e94d1550b369..8d8bd2496ec037f729df0eb60416667f655dda3d:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 184d7da24b..02d6431d79 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -288,6 +288,18 @@ wxWindow::~wxWindow() m_isBeingDeleted = TRUE; MSWDetachWindowMenu(); + + // VS: make sure there's no wxFrame with last focus set to us: + for (wxWindow *win = GetParent(); win; win = win->GetParent()) + { + wxFrame *frame = wxDynamicCast(win, wxFrame); + if ( frame ) + { + if ( frame->GetLastFocus() == this ) + frame->SetLastFocus((wxWindow*)NULL); + break; + } + } if ( m_parent ) m_parent->RemoveChild(this);