From 677051b6e76f8a3a17de70c917ec0a50711b1ff9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 27 Oct 2017 18:02:48 +0200 Subject: [PATCH] Remove hack with TLW focus reset from wxWindowMSW dtor This shouldn't be needed any more, after the previous commit which replaces the raw pointer to the focused child in wxTopLevelWindowMSW with a safe weak reference. --- src/msw/window.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 31cfb51682..68f0fedcc4 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -405,30 +405,9 @@ wxWindowMSW::~wxWindowMSW() { SendDestroyEvent(); -#ifndef __WXUNIVERSAL__ - // VS: make sure there's no wxFrame with last focus set to us: - for ( wxWindow *win = GetParent(); win; win = win->GetParent() ) - { - wxTopLevelWindow *frame = wxDynamicCast(win, wxTopLevelWindow); - if ( frame ) - { - if ( frame->GetLastFocus() == this ) - { - frame->SetLastFocus(NULL); - } - - // apparently sometimes we can end up with our grand parent - // pointing to us as well: this is surely a bug in focus handling - // code but it's not clear where it happens so for now just try to - // fix it here by not breaking out of the loop - //break; - } - } -#endif // __WXUNIVERSAL__ - // VS: destroy children first and _then_ detach *this from its parent. // If we did it the other way around, children wouldn't be able - // find their parent frame (see above). + // find their parent frame. DestroyChildren(); if ( m_hWnd )