diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-10 12:53:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-11 06:55:41 +0000 |
commit | 78b4a1fb01af9ad3b3395a22f6e396be914b553e (patch) | |
tree | 846fdaea907a70fdc274a1e76642ed5e06622c0d /framework | |
parent | 071e23fee07b92b8f07800cda3ca7e66afe818ae (diff) |
update vclwidget loplugin to find ref-dropping assigment
Look for places where we are accidentally assigning a returned-by-value
VclPtr<T> to a T*, which generally ends up in a use-after-free.
Change-Id: I4f361eaca88820cdb7aa3b8340212db61580fdd9
Reviewed-on: https://gerrit.libreoffice.org/30749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
24 files changed, 117 insertions, 117 deletions
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index eedefcd36da5..afab7e871798 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -71,9 +71,9 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent uno::Reference<awt::XWindow> xWindow = xTarget->getContainerWindow(); if (xWindow.is()) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if (pWindow->IsSystemWindow()) - m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow); + m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow.get()); } } @@ -603,7 +603,7 @@ css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRig // Because sometimes VCL create "implicit border windows" as parents even we created // a simple XWindow using the toolkit only .-( SolarMutexGuard aSolarLock; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( (pWindow ) && (pWindow->IsSystemWindow()) diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx index bc9e6389d707..1470007553ae 100644 --- a/framework/source/dispatch/windowcommanddispatch.cxx +++ b/framework/source/dispatch/windowcommanddispatch.cxx @@ -62,7 +62,7 @@ void WindowCommandDispatch::impl_startListening() { SolarMutexGuard aSolarLock; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if ( ! pWindow) return; @@ -82,7 +82,7 @@ void WindowCommandDispatch::impl_stopListening() { SolarMutexGuard aSolarLock; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if (!pWindow) return; diff --git a/framework/source/helper/persistentwindowstate.cxx b/framework/source/helper/persistentwindowstate.cxx index 911833596342..6cfb1f075c00 100644 --- a/framework/source/helper/persistentwindowstate.cxx +++ b/framework/source/helper/persistentwindowstate.cxx @@ -213,7 +213,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno:: // SOLAR SAFE -> ------------------------ SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); // check for system window is necessary to guarantee correct pointer cast! if ( (pWindow ) && @@ -222,7 +222,7 @@ OUString PersistentWindowState::implst_getWindowStateFromWindow(const css::uno:: { WindowStateMask nMask = WindowStateMask::All & ~(WindowStateMask::Minimized); sWindowState = OStringToOUString( - static_cast<SystemWindow*>(pWindow)->GetWindowState(nMask), + static_cast<SystemWindow*>(pWindow.get())->GetWindowState(nMask), RTL_TEXTENCODING_UTF8); } // <- SOLAR SAFE ------------------------ @@ -243,7 +243,7 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere // SOLAR SAFE -> ------------------------ SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if (!pWindow) return; @@ -254,8 +254,8 @@ void PersistentWindowState::implst_setWindowStateOnWindow(const css::uno::Refere if (!bSystemWindow && !bWorkWindow) return; - SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindow); - WorkWindow* pWorkWindow = static_cast<WorkWindow* >(pWindow); + SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindow.get()); + WorkWindow* pWorkWindow = static_cast<WorkWindow* >(pWindow.get()); // don't save this special state! if (pWorkWindow->IsMinimized()) diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 67432898f664..9f4d658ed2c4 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -373,7 +373,7 @@ void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed() impl_showProgress(); SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xParentWindow); if ( pWindow ) { bool bForceFrontAndFocus(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext)); diff --git a/framework/source/helper/tagwindowasmodified.cxx b/framework/source/helper/tagwindowasmodified.cxx index 5f47e85e5854..47eb85bdedbb 100644 --- a/framework/source/helper/tagwindowasmodified.cxx +++ b/framework/source/helper/tagwindowasmodified.cxx @@ -88,7 +88,7 @@ void SAL_CALL TagWindowAsModified::modified(const css::lang::EventObject& aEvent // SYNCHRONIZED -> SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if ( ! pWindow) return; diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 4977e97bd40f..0f600e5a01bd 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -170,13 +170,13 @@ void TitleBarUpdate::impl_updateApplicationID(const css::uno::Reference< css::fr // VCL SYNCHRONIZED -> SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow )); + VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow )); if ( ( pWindow ) && ( pWindow->GetType() == WINDOW_WORKWINDOW ) ) { - WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow); + WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get()); pWorkWindow->SetApplicationID( sApplicationID ); } // <- VCL SYNCHRONIZED @@ -287,13 +287,13 @@ void TitleBarUpdate::impl_updateIcon(const css::uno::Reference< css::frame::XFra // VCL SYNCHRONIZED -> SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow )); + VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow )); if ( ( pWindow ) && ( pWindow->GetType() == WINDOW_WORKWINDOW ) ) { - WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow); + WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get()); pWorkWindow->SetIcon( (sal_uInt16)nIcon ); css::uno::Reference< css::frame::XModel > xModel = xController->getModel(); @@ -321,13 +321,13 @@ void TitleBarUpdate::impl_updateTitle(const css::uno::Reference< css::frame::XFr // VCL SYNCHRONIZED -> SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xWindow )); + VclPtr<vcl::Window> pWindow = (VCLUnoHelper::GetWindow( xWindow )); if ( ( pWindow ) && ( pWindow->GetType() == WINDOW_WORKWINDOW ) ) { - WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow); + WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get()); pWorkWindow->SetText( sTitle ); } // <- VCL SYNCHRONIZED diff --git a/framework/source/helper/vclstatusindicator.cxx b/framework/source/helper/vclstatusindicator.cxx index 463cba642206..1ca763ed5cd7 100644 --- a/framework/source/helper/vclstatusindicator.cxx +++ b/framework/source/helper/vclstatusindicator.cxx @@ -46,7 +46,7 @@ void SAL_CALL VCLStatusIndicator::start(const OUString& sText , { SolarMutexGuard aSolarGuard; - vcl::Window* pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow); + VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow(m_xParentWindow); if (!m_pStatusBar) m_pStatusBar = VclPtr<StatusBar>::Create(pParentWindow, WB_3DLOOK|WB_BORDER); diff --git a/framework/source/inc/pattern/window.hxx b/framework/source/inc/pattern/window.hxx index 87c95ad04174..04aa9d0a4ead 100644 --- a/framework/source/inc/pattern/window.hxx +++ b/framework/source/inc/pattern/window.hxx @@ -54,7 +54,7 @@ static bool isTopWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) // Because sometimes VCL create "implicit border windows" as parents even we created // a simple XWindow using the toolkit only .-( SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( (pWindow ) && (pWindow->IsSystemWindow()) diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index e7f1d0dba93b..7bf7a3d72660 100644 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -118,12 +118,12 @@ vcl::Window* getWindowFromXUIElement( const uno::Reference< ui::XUIElement >& xU SystemWindow* getTopSystemWindow( const uno::Reference< awt::XWindow >& xWindow ) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); while ( pWindow && !pWindow->IsSystemWindow() ) pWindow = pWindow->GetParent(); if ( pWindow ) - return static_cast<SystemWindow *>(pWindow); + return static_cast<SystemWindow *>(pWindow.get()); else return nullptr; } @@ -150,10 +150,10 @@ bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt: _xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY ); _rPosSize = _xWindow->getPosSize(); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( _xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( _xWindow ); if ( pWindow->GetType() == WINDOW_TOOLBOX ) { - ::Size aSize = static_cast<ToolBox*>(pWindow)->CalcWindowSizePixel( 1 ); + ::Size aSize = static_cast<ToolBox*>(pWindow.get())->CalcWindowSizePixel( 1 ); _rPosSize.Width = aSize.Width(); _rPosSize.Height = aSize.Height(); } @@ -291,8 +291,8 @@ bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) // #i76867# top and system window is required. SolarMutexGuard aGuard; uno::Reference< awt::XWindow > xWindow( xWindowCheck, uno::UNO_QUERY ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - return ( pWindow && pWindow->IsSystemWindow() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); + return pWindow && pWindow->IsSystemWindow(); } return false; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index c43ba899a659..e808aabc70ff 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -897,10 +897,10 @@ void LayoutManager::implts_createProgressBar() Reference< awt::XWindow > xStatusBarWindow = pWrapper->getStatusBar(); SolarMutexGuard aGuard; - vcl::Window* pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow ); + VclPtr<vcl::Window> pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow ); if ( !pStatusBarWnd ) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pWindow ) { VclPtrInstance<StatusBar> pStatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) ); @@ -982,14 +982,14 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz if ( xWindow.is() ) { SolarMutexGuard aGuard; - vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pParentWindow && ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )) { vcl::Window* pOldParentWindow = pWindow->GetParent(); if ( pParentWindow != pOldParentWindow ) pWindow->SetParent( pParentWindow ); - static_cast<StatusBar *>(pWindow)->SetPosSizePixel( rPos, rSize ); + static_cast<StatusBar *>(pWindow.get())->SetPosSizePixel( rPos, rSize ); } } } @@ -1024,7 +1024,7 @@ bool LayoutManager::implts_showProgressBar() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) { if ( !pWindow->IsVisible() ) @@ -1064,7 +1064,7 @@ bool LayoutManager::implts_hideProgressBar() implts_readStatusBarState( STATUS_BAR_ALIAS ); bHideStatusBar = !m_aStatusBarElement.m_bVisible; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->IsVisible() && ( bHideStatusBar || bInternalStatusBar )) { implts_setOffset( 0 ); @@ -1089,7 +1089,7 @@ bool LayoutManager::implts_showStatusBar( bool bStoreState ) Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && !pWindow->IsVisible() ) { implts_setOffset( pWindow->GetSizePixel().Height() ); @@ -1115,7 +1115,7 @@ bool LayoutManager::implts_hideStatusBar( bool bStoreState ) Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->IsVisible() ) { implts_setOffset( 0 ); @@ -1301,7 +1301,7 @@ throw ( RuntimeException, std::exception ) if ( pToolbarManager ) pToolbarManager->resetDockingArea(); - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pContainerWindow ) pContainerWindow->RemoveChildEventListener( LINK( this, LayoutManager, WindowEventListener ) ); } @@ -1323,7 +1323,7 @@ throw ( RuntimeException, std::exception ) // and we get no notification anymore { SolarMutexGuard aGuard; - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if( pContainerWindow ) m_bParentWindowVisible = pContainerWindow->IsVisible(); } @@ -1339,7 +1339,7 @@ throw ( RuntimeException, std::exception ) SolarMutexGuard aGuard; // Add layout manager as listener to get notifications about toolbar button activities - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pContainerWindow ) pContainerWindow->AddChildEventListener( LINK( this, LayoutManager, WindowEventListener ) ); @@ -1394,8 +1394,8 @@ void LayoutManager::implts_reparentChildWindows() if ( xStatusBarWindow.is() ) { SolarMutexGuard aGuard; - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow ); if ( pWindow && pContainerWindow ) pWindow->SetParent( pContainerWindow ); } @@ -1666,7 +1666,7 @@ throw (uno::RuntimeException, std::exception) // we need VCL here to pass special flags to Show() SolarMutexGuard aGuard; Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) { pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate ); @@ -2118,7 +2118,7 @@ throw (RuntimeException, std::exception) if ( xWindow.is() ) { SolarMutexGuard g; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->IsVisible() ) return true; else diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 4424595343b3..583d622ae3e1 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -279,7 +279,7 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea() { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible && !pConstIter->m_bMasterHide ) { awt::Rectangle aPosSize = xWindow->getPosSize(); @@ -532,10 +532,10 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) SvtCommandOptions aCmdOptions; SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { - ToolBox* pToolbar = static_cast<ToolBox *>(pWindow); + ToolBox* pToolbar = static_cast<ToolBox *>(pWindow.get()); ToolBoxMenuType nMenuType = pToolbar->GetMenuType(); if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, "ConfigureDialog" )) pToolbar->SetMenuType( nMenuType & ~ToolBoxMenuType::Customize ); @@ -1157,12 +1157,12 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() { // Set generic title for add-on toolbar SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow->GetText().isEmpty() ) pWindow->SetText( aGenericAddonTitle ); if ( pWindow->GetType() == WINDOW_TOOLBOX ) { - ToolBox* pToolbar = static_cast<ToolBox *>(pWindow); + ToolBox* pToolbar = static_cast<ToolBox *>(pWindow.get()); pToolbar->SetMenuType(); } } @@ -1329,11 +1329,11 @@ void ToolbarLayoutManager::implts_reparentToolbars() { SolarMutexClearableGuard aWriteLock; UIElementVector aUIElementVector = m_aUIElements; - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - vcl::Window* pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); - vcl::Window* pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); - vcl::Window* pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); - vcl::Window* pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + VclPtr<vcl::Window> pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + VclPtr<vcl::Window> pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + VclPtr<vcl::Window> pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + VclPtr<vcl::Window> pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); aWriteLock.clear(); SolarMutexGuard aGuard; @@ -1360,7 +1360,7 @@ void ToolbarLayoutManager::implts_reparentToolbars() { } - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) { // Reparent our child windows according to their current state. @@ -1696,7 +1696,7 @@ uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const OU vcl::Window* ToolbarLayoutManager::implts_getWindow( const OUString& aName ) { uno::Reference< awt::XWindow > xWindow = implts_getXWindow( aName ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); return pWindow; } @@ -1754,7 +1754,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() if ( xContainerWindow.is() ) { SolarMutexGuard aGuard; - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pContainerWindow ) aStartPos = AWTPoint(pContainerWindow->OutputToScreenPixel(VCLPoint(aStartPos))); } @@ -1778,7 +1778,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() if ( xDockWindow.is() && xDockWindow->isFloating() ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->IsVisible() ) { awt::Rectangle aFloatRect = xWindow->getPosSize(); @@ -2048,7 +2048,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D if ( xWindow.is() ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); if ( pWindow && pIter->m_bVisible && xDockWindow.is() && !pIter->m_bFloating ) aWindowVector.push_back( *pIter ); // docked windows @@ -2145,8 +2145,8 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D else { SolarMutexClearableGuard aReadLock; - vcl::Window* pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow )); - vcl::Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] )); + VclPtr<vcl::Window> pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow )); + VclPtr<vcl::Window> pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] )); aReadLock.clear(); // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect @@ -2468,9 +2468,9 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( SolarMutexGuard aGuard; { uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - aMinSize = static_cast<ToolBox *>(pWindow)->CalcMinimumWindowSizePixel(); + aMinSize = static_cast<ToolBox *>(pWindow.get())->CalcMinimumWindowSizePixel(); } if (( aMinSize.Width() > 0 ) && ( aMinSize.Height() > 0 )) @@ -2521,7 +2521,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( } SolarMutexClearableGuard aReadLock; - vcl::Window* pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] ); + VclPtr<vcl::Window> pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] ); aReadLock.clear(); sal_Int32 nCurrPos( 0 ); @@ -2530,7 +2530,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( for ( sal_uInt32 i = 0; i < nCount; i++ ) { uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); vcl::Window* pOldParentWindow = pWindow->GetParent(); if ( pDockAreaWindow != pOldParentWindow ) @@ -2630,9 +2630,9 @@ void ToolbarLayoutManager::implts_calcDockingPosSize( { SolarMutexGuard aGuard; pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - vcl::Window* pDockWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pDockWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = static_cast<ToolBox *>(pDockWindow); + pToolBox = static_cast<ToolBox *>(pDockWindow.get()); aDockingAreaRect = ::Rectangle( pDockingAreaWindow->GetPosPixel(), pDockingAreaWindow->GetSizePixel() ); if ( pToolBox ) @@ -3068,7 +3068,7 @@ framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_d { SolarMutexGuard aGuard; pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - vcl::Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); } @@ -3282,10 +3282,10 @@ throw (uno::RuntimeException, std::exception) SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { - ToolBox* pToolBox = static_cast<ToolBox *>(pWindow); + ToolBox* pToolBox = static_cast<ToolBox *>(pWindow.get()); aUIElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); aUIElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); } @@ -3352,7 +3352,7 @@ throw (uno::RuntimeException, std::exception) ::Rectangle aRightDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height )); ::Rectangle aHotZoneRightDockRect( implts_calcHotZoneRect( aRightDockRect, nMagneticZone )); - vcl::Window* pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) ); + VclPtr<vcl::Window> pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) ); ::Point aMousePos( pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ))); if ( aHotZoneTopDockRect.IsInside( aMousePos )) @@ -3375,10 +3375,10 @@ throw (uno::RuntimeException, std::exception) eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT; // Determine if we have a toolbar and set alignment according to the docking area! - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); ToolBox* pToolBox = nullptr; if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = static_cast<ToolBox *>(pWindow); + pToolBox = static_cast<ToolBox *>(pWindow.get()); if ( eDockingArea != -1 ) { @@ -3528,10 +3528,10 @@ throw (uno::RuntimeException, std::exception) if ( bDockingInProgress ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( uno::Reference< awt::XWindow >( e.Source, uno::UNO_QUERY )); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( uno::Reference< awt::XWindow >( e.Source, uno::UNO_QUERY )); ToolBox* pToolBox = nullptr; if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = static_cast<ToolBox *>(pWindow); + pToolBox = static_cast<ToolBox *>(pWindow.get()); if ( pToolBox ) { @@ -3589,10 +3589,10 @@ throw (uno::RuntimeException, std::exception) { { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { - ToolBox* pToolBox = static_cast< ToolBox *>( pWindow ); + ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() ); aUIDockingElement.m_aFloatingData.m_aPos = AWTPoint(pToolBox->GetPosPixel()); aUIDockingElement.m_aFloatingData.m_aSize = AWTSize(pToolBox->GetOutputSizePixel()); aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index c225542be62f..27285125f464 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1445,7 +1445,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() if (xModified->isModified()) return css::uno::Reference< css::frame::XFrame >(); - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xTask->getContainerWindow()); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xTask->getContainerWindow()); if (pWindow && pWindow->IsInModalMode()) return css::uno::Reference< css::frame::XFrame >(); @@ -1519,10 +1519,10 @@ void LoadEnv::impl_reactForLoadingState() if (bMinimized) { SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); // check for system window is necessary to guarantee correct pointer cast! if (pWindow && pWindow->IsSystemWindow()) - static_cast<WorkWindow*>(pWindow)->Minimize(); + static_cast<WorkWindow*>(pWindow.get())->Minimize(); } else if (!bHidden) { @@ -1627,7 +1627,7 @@ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::X // <- SAFE ---------------------------------- SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if ( pWindow ) { bool const preview( m_lMediaDescriptor.getUnpackedValueOrDefault( @@ -1671,7 +1671,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw // SOLAR SAFE -> SolarMutexClearableGuard aSolarGuard1; - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if (!pWindow) return; @@ -1682,7 +1682,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw return; // don't overwrite this special state! - WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow); + WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get()); if (pWorkWindow->IsMinimized()) return; @@ -1739,11 +1739,11 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw // But if we get a valid pointer we can be sure, that it's the system window pointer // we already checked and used before. Because nobody recycle the same uno reference for // a new internal c++ implementation ... hopefully .-)) - vcl::Window* pWindowCheck = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindowCheck = VCLUnoHelper::GetWindow(xWindow); if (! pWindowCheck) return; - SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindowCheck); + SystemWindow* pSystemWindow = static_cast<SystemWindow*>(pWindowCheck.get()); pSystemWindow->SetWindowState(OUStringToOString(sWindowState,RTL_TEXTENCODING_UTF8)); // <- SOLAR SAFE } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index a1b4fe6f78f6..09e5104652f6 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -873,7 +873,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& m_xContainerWindow = xWindow; // if window is initially visible, we will never get a windowShowing event - vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow); if (pWindow && pWindow->IsVisible()) m_bIsHidden = false; @@ -1540,7 +1540,7 @@ sal_Bool SAL_CALL Frame::setComponent(const css::uno::Reference< css::awt::XWind css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow; css::uno::Reference< css::frame::XController > xOldController = m_xController; - vcl::Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + VclPtr<vcl::Window> pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow ); bool bHadFocus = pOwnWindow->HasChildPathFocus(); bool bWasConnected = m_bConnected; aReadLock.clear(); @@ -2660,7 +2660,7 @@ void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& ) ) { css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow(); - vcl::Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); + VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); //#i70261#: dialogs opened from an OLE object will cause a deactivate on the frame of the OLE object // on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after // the deactivation the focus will be set into the dialog! @@ -3218,13 +3218,13 @@ void Frame::implts_setIconOnWindow() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ { SolarMutexGuard aSolarGuard; - vcl::Window* pWindow = (VCLUnoHelper::GetWindow( xContainerWindow )); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if( ( pWindow != nullptr ) && ( pWindow->GetType() == WINDOW_WORKWINDOW ) ) { - WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow); + WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get()); pWorkWindow->SetIcon( (sal_uInt16)nIcon ); } } diff --git a/framework/source/services/taskcreatorsrv.cxx b/framework/source/services/taskcreatorsrv.cxx index 11203415d74e..8757f8ae0d12 100644 --- a/framework/source/services/taskcreatorsrv.cxx +++ b/framework/source/services/taskcreatorsrv.cxx @@ -216,7 +216,7 @@ void TaskCreatorService::implts_applyDocStyleToWindow(const css::uno::Reference< { // SYNCHRONIZED -> SolarMutexGuard aSolarGuard; - vcl::Window* pVCLWindow = VCLUnoHelper::GetWindow(xWindow); + VclPtr<vcl::Window> pVCLWindow = VCLUnoHelper::GetWindow(xWindow); if (pVCLWindow) pVCLWindow->SetExtendedStyle(WB_EXT_DOCUMENT); // <- SYNCHRONIZED diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx index edd628976ff4..be924dbb1519 100644 --- a/framework/source/tabwin/tabwindow.cxx +++ b/framework/source/tabwin/tabwindow.cxx @@ -140,9 +140,9 @@ void TabWindow::implts_LayoutWindows() const TabControl* TabWindow::impl_GetTabControl( const css::uno::Reference< css::awt::XWindow >& rTabControlWindow ) const { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( rTabControlWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( rTabControlWindow ); if ( pWindow ) - return static_cast<TabControl *>(pWindow); + return static_cast<TabControl *>(pWindow.get()); else return nullptr; } @@ -151,7 +151,7 @@ void TabWindow::impl_SetTitle( const OUString& rTitle ) { if ( m_xTopWindow.is() ) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( css::uno::Reference< css::awt::XWindow >( m_xTopWindow, css::uno::UNO_QUERY )); if ( pWindow ) @@ -385,7 +385,7 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception) xWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE ); SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if( pWindow ) pWindow->Show(); @@ -397,7 +397,7 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception) if ( pWindow ) { pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate ); - TabControl* pTabControl = static_cast<TabControl *>(pWindow); + TabControl* pTabControl = static_cast<TabControl *>(pWindow.get()); pTabControl->SetActivatePageHdl( LINK( this, TabWindow, Activate )); pTabControl->SetDeactivatePageHdl( LINK( this, TabWindow, Deactivate )); } @@ -507,7 +507,7 @@ throw( css::uno::RuntimeException, std::exception ) if ( m_xContainerWindow.is() ) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pWindow ) pWindow->Show(); } @@ -519,7 +519,7 @@ throw( css::uno::RuntimeException, std::exception ) SolarMutexGuard g; if ( m_xContainerWindow.is() ) { - vcl::Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pWindow ) pWindow->Hide(); } diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 5e9a5368bf4d..b3074486d898 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -353,7 +353,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue Reference< XWindow > xWindow = xTbxController->createItemWindow( xToolbarWindow ); if ( xWindow.is() ) { - vcl::Window* pItemWin = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pItemWin = VCLUnoHelper::GetWindow( xWindow ); if ( pItemWin ) { WindowType nType = pItemWin->GetType(); diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 5ce44fd4ad6a..4de793340e67 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -109,7 +109,7 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument AddonsToolBarManager* pToolBarManager = nullptr; { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); if ( pWindow ) { sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index c4df1f21c6c1..530df3e77fcd 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -996,7 +996,7 @@ IMPL_LINK( MenuBarManager, Select, Menu *, pMenu, bool ) xList->getByIndex(i) >>= xFrame; if ( xFrame.is() && nTaskId == nCurItemId ) { - vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); pWin->GrabFocus(); pWin->ToTop( ToTopFlags::RestoreWhenMin ); break; @@ -2012,7 +2012,7 @@ void MenuBarManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XComp if ( xFrame == xCurrentFrame ) nActiveItemId = nItemId; - vcl::Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); OUString sWindowTitle; if ( pWin && pWin->IsVisible() ) sWindowTitle = pWin->GetText(); diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx index 916b0017eef5..c858484ad715 100644 --- a/framework/source/uielement/progressbarwrapper.cxx +++ b/framework/source/uielement/progressbarwrapper.cxx @@ -104,10 +104,10 @@ void ProgressBarWrapper::start( const OUString& Text, ::sal_Int32 Range ) if ( xWindow.is() ) { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR ) { - StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow); + StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get()); if ( !pStatusBar->IsProgressMode() ) pStatusBar->StartProgressMode( Text ); else @@ -142,10 +142,10 @@ void ProgressBarWrapper::end() if ( xWindow.is() ) { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR ) { - StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow); + StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get()); if ( pStatusBar->IsProgressMode() ) pStatusBar->EndProgressMode(); } @@ -172,10 +172,10 @@ void ProgressBarWrapper::setText( const OUString& Text ) if ( xWindow.is() ) { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR ) { - StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow); + StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get()); if( pStatusBar->IsProgressMode() ) { pStatusBar->SetUpdateMode( false ); @@ -225,10 +225,10 @@ void ProgressBarWrapper::setValue( ::sal_Int32 nValue ) if ( xWindow.is() && bSetValue ) { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR ) { - StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow); + StatusBar* pStatusBar = static_cast<StatusBar *>(pWindow.get()); if ( !pStatusBar->IsProgressMode() ) pStatusBar->StartProgressMode( aText ); pStatusBar->SetProgressValue( sal_uInt16( nValue )); diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx index bf843b9cec5d..3456dc78e529 100644 --- a/framework/source/uielement/statusbarwrapper.cxx +++ b/framework/source/uielement/statusbarwrapper.cxx @@ -104,7 +104,7 @@ void SAL_CALL StatusBarWrapper::initialize( const Sequence< Any >& aArguments ) StatusBarManager* pStatusBarManager( nullptr ); { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); if ( pWindow ) { sal_uLong nStyles = WinBits( WB_LEFT | WB_3DLOOK ); diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index af44f8a1199e..36f679a11a79 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -240,10 +240,10 @@ css::uno::Reference< css::awt::XWindow > SubToolBarController::createPopupWindow disposeUIElement(); m_xUIElement = xUIElement; - vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); + VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX ) { - ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow ); + ToolBox* pToolBar = static_cast< ToolBox* >( pTbxWindow.get() ); pToolBar->SetParent( pToolBox ); // calc and set size for popup mode Size aSize = pToolBar->CalcPopupWindowSizePixel(); @@ -381,7 +381,7 @@ void SubToolBarController::endPopupMode( const css::awt::EndPopupModeEvent& e ) OUString aPersistentString( "Persistent" ); try { - vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); + VclPtr<vcl::Window> pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX ) { css::uno::Any a = xProp->getPropertyValue( aPersistentString ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 20091251da52..4c330b3e64ce 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -848,7 +848,7 @@ void ToolBarManager::CreateControllers() Reference< XWindow > xWindow = xTbxController->createItemWindow( xToolbarWindow ); if ( xWindow.is() ) { - vcl::Window* pItemWin = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pItemWin = VCLUnoHelper::GetWindow( xWindow ); if ( pItemWin ) { WindowType nType = pItemWin->GetType(); @@ -1869,8 +1869,8 @@ IMPL_STATIC_LINK( ToolBarManager, ExecuteHdl_Impl, void*, p, void ) // Use docking window close to close the toolbar. The toolbar layout manager is // listener and will react correctly according to the context sensitive // flag of our toolbar. - vcl::Window* pWin = VCLUnoHelper::GetWindow( pExecuteInfo->xWindow ); - DockingWindow* pDockWin = dynamic_cast< DockingWindow* >( pWin ); + VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( pExecuteInfo->xWindow ); + DockingWindow* pDockWin = dynamic_cast< DockingWindow* >( pWin.get() ); if ( pDockWin ) pDockWin->Close(); } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index caeaec5bebae..003c74c07723 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -250,7 +250,7 @@ Sequence< Sequence< css::beans::PropertyValue > > ToolbarsMenuController::getLay SolarMutexGuard aGuard; Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) aToolBarInfo.aToolBarUIName = pWindow->GetText(); diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index c57783e23a68..8733666c047b 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -145,7 +145,7 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) th ToolBarManager* pToolBarManager = nullptr; { SolarMutexGuard aSolarMutexGuard; - vcl::Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); if ( pWindow ) { sal_uLong nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; |