don't crash when restoring focus after showing a modal dialog
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25294 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -169,16 +169,6 @@ void wxDialog::DoShowModal()
|
|||||||
|
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
|
|
||||||
// remember where the focus was
|
|
||||||
wxWindow *winFocus = FindFocus();
|
|
||||||
if ( !winFocus )
|
|
||||||
{
|
|
||||||
winFocus = parent;
|
|
||||||
}
|
|
||||||
if ( !winFocus )
|
|
||||||
{
|
|
||||||
winFocus = wxTheApp->GetTopWindow();
|
|
||||||
}
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
||||||
#else
|
#else
|
||||||
@@ -198,13 +188,6 @@ void wxDialog::DoShowModal()
|
|||||||
// TODO probably reenable the parent window if any
|
// TODO probably reenable the parent window if any
|
||||||
s_macIsInModalLoop = formerModal ;
|
s_macIsInModalLoop = formerModal ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// and restore focus
|
|
||||||
if ( winFocus )
|
|
||||||
{
|
|
||||||
winFocus->SetFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -169,16 +169,6 @@ void wxDialog::DoShowModal()
|
|||||||
|
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
|
|
||||||
// remember where the focus was
|
|
||||||
wxWindow *winFocus = FindFocus();
|
|
||||||
if ( !winFocus )
|
|
||||||
{
|
|
||||||
winFocus = parent;
|
|
||||||
}
|
|
||||||
if ( !winFocus )
|
|
||||||
{
|
|
||||||
winFocus = wxTheApp->GetTopWindow();
|
|
||||||
}
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
||||||
#else
|
#else
|
||||||
@@ -198,13 +188,6 @@ void wxDialog::DoShowModal()
|
|||||||
// TODO probably reenable the parent window if any
|
// TODO probably reenable the parent window if any
|
||||||
s_macIsInModalLoop = formerModal ;
|
s_macIsInModalLoop = formerModal ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// and restore focus
|
|
||||||
if ( winFocus )
|
|
||||||
{
|
|
||||||
winFocus->SetFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user