diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 5d8bd6c5bb7c..6027819ede7f 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include @@ -203,16 +203,17 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, weld::ComboBox&, bool) Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext ); Reference< XFrame > xFrame = xDesktop->getActiveFrame(); - if ( xFrame.is() ) - { - VclPtr pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - if ( pWin ) - { - pWin->GrabFocus(); - pWin->ToTop( ToTopFlags::RestoreWhenMin ); - } - } + if (!xFrame.is()) + return true; + auto xWin = xFrame->getContainerWindow(); + if (!xWin) + return true; + xWin->setFocus(); + Reference xTop(xWin, UNO_QUERY); + if (!xTop) + return true; + xTop->toFront(); return true; }