summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-25 16:23:17 +0200
committerAndras Timar <andras.timar@collabora.com>2017-02-18 00:45:43 +0100
commit390e951b78288e082361c386ff5c6618d917c333 (patch)
treede4f00b80ba6183f2678d6582d98d65a94b93aa7 /sfx2
parent599719217423e8468cc54cc74e7850b8a867120b (diff)
loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result of VclPtr<T>::Create to a raw pointer. As a consequence, we also need to change various methods that were returning newly created Window subclasses via raw pointer, to instead return those via VclPtr Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b Reviewed-on: https://gerrit.libreoffice.org/31318 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit e6ffb539ee232ea0c679928ff456c1cf97429f63)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/workwin.cxx8
-rw-r--r--sfx2/source/dialog/backingwindow.cxx6
-rw-r--r--sfx2/source/doc/guisaveas.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/printhelper.cxx4
-rw-r--r--sfx2/source/doc/printhelper.hxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx2
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx2
-rw-r--r--sfx2/source/sidebar/UnoPanel.cxx2
9 files changed, 14 insertions, 16 deletions
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 61a688ce6f4e..a030bb88e6bb 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -581,7 +581,7 @@ void SfxWorkWindow::DeleteControllers_Impl()
// DockingWindows)
for (size_t n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const &p = pSplit[n];
if (p->GetWindowCount())
p->Lock();
}
@@ -1165,7 +1165,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
sal_uInt16 n;
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
p->Lock();
}
@@ -1250,7 +1250,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
// Unlock the SplitWindows again
for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
- SfxSplitWindow *p = pSplit[n];
+ VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
p->Lock(false);
}
@@ -2388,7 +2388,7 @@ void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow *pActSplitWin )
// (not pinned, FadeIn).
// Only the abandoned window may be invisible, because perhaps its
// size is just being calculated before it is displayed.
- SfxSplitWindow* pSplitWin = pSplit[n];
+ VclPtr<SfxSplitWindow> const & pSplitWin = pSplit[n];
bool bDummyWindow = !pSplitWin->IsFadeIn();
vcl::Window *pDummy = pSplitWin->GetSplitWindow();
vcl::Window *pWin = bDummyWindow ? pDummy : pSplitWin;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 15fa22588712..3afb9420b230 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -175,9 +175,8 @@ void BackingWindow::dispose()
// deregister drag&drop helper
if (mxDropTargetListener.is())
{
- for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto const & pDndWin : maDndWindows)
{
- vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
@@ -499,9 +498,8 @@ void BackingWindow::setOwningFrame( const css::uno::Reference< css::frame::XFram
// establish drag&drop mode
mxDropTargetListener.set(new OpenFileDropTargetListener(mxContext, mxFrame));
- for (auto aI = maDndWindows.begin(), aEnd = maDndWindows.end(); aI != aEnd; ++aI)
+ for (auto const & pDndWin : maDndWindows)
{
- vcl::Window *pDndWin = *aI;
css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget =
pDndWin->GetDropTarget();
if (xDropTarget.is())
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 03b005fc4d11..7dcc6286271c 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1832,7 +1832,7 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel )
{
- vcl::Window* pWin = nullptr;
+ VclPtr<vcl::Window> pWin;
try {
if ( xModel.is() )
{
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index f750d1ee74dd..c862ad74001c 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1659,7 +1659,7 @@ bool SfxObjectShell::AdjustMacroMode()
vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium )
{
- vcl::Window* pWindow = nullptr;
+ VclPtr<vcl::Window> pWindow;
SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet();
const SfxUnoFrameItem* pUnoItem = SfxItemSet::GetItem<SfxUnoFrameItem>(pSet, SID_FILLFRAME, false);
if ( pUnoItem )
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index d84f56b556a2..8887ca079ac6 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -313,7 +313,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter,
- SfxPrinter*& pPrinter,
+ VclPtr<SfxPrinter>& pPrinter,
SfxPrinterChangeFlags& nChangeFlags,
SfxViewShell*& pViewSh)
@@ -457,7 +457,7 @@ void SAL_CALL SfxPrintHelper::setPrinter(const uno::Sequence< beans::PropertyVal
SolarMutexGuard aGuard;
SfxViewShell* pViewSh = nullptr;
- SfxPrinter* pPrinter = nullptr;
+ VclPtr<SfxPrinter> pPrinter;
SfxPrinterChangeFlags nChangeFlags = SfxPrinterChangeFlags::NONE;
impl_setPrinter(rPrinter,pPrinter,nChangeFlags,pViewSh);
// set new printer
diff --git a/sfx2/source/doc/printhelper.hxx b/sfx2/source/doc/printhelper.hxx
index aedd9e211b6c..a91e5b5c384c 100644
--- a/sfx2/source/doc/printhelper.hxx
+++ b/sfx2/source/doc/printhelper.hxx
@@ -62,7 +62,7 @@ private:
osl::Mutex m_aMutex;
IMPL_PrintListener_DataContainer* m_pData ;
void impl_setPrinter(const css::uno::Sequence< css::beans::PropertyValue >& rPrinter,
- SfxPrinter*& pPrinter,
+ VclPtr<SfxPrinter>& pPrinter,
SfxPrinterChangeFlags& nChangeFlags,
SfxViewShell*& pViewSh);
} ;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 87179deafe99..9994b5825087 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -419,7 +419,7 @@ SfxOwnFramesLocker::~SfxOwnFramesLocker()
vcl::Window* SfxOwnFramesLocker::GetVCLWindow( const Reference< frame::XFrame >& xFrame )
{
- vcl::Window* pWindow = nullptr;
+ VclPtr<vcl::Window> pWindow;
if ( xFrame.is() )
{
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index d6a51a01f2e9..97742b73b5fc 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -346,7 +346,7 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc)
for ( SharedPanelContainer::iterator iPanel(rPanels.begin()), iEnd(rPanels.end());
iPanel!=iEnd; ++iPanel)
{
- Panel* aPanel = *iPanel;
+ VclPtr<Panel> const & aPanel = *iPanel;
OUString panelId = aPanel->GetId();
std::shared_ptr<PanelDescriptor> xPanelDesc = GetPanelDescriptor(panelId);
diff --git a/sfx2/source/sidebar/UnoPanel.cxx b/sfx2/source/sidebar/UnoPanel.cxx
index 917a23692919..e696e32b0b88 100644
--- a/sfx2/source/sidebar/UnoPanel.cxx
+++ b/sfx2/source/sidebar/UnoPanel.cxx
@@ -98,7 +98,7 @@ void SAL_CALL SfxUnoPanel::expand( const sal_Bool bCollapseOther )
for ( SharedPanelContainer::iterator iPanel(aPanels.begin()), iEnd(aPanels.end());
iPanel!=iEnd; ++iPanel)
{
- Panel* aPanel = *iPanel;
+ VclPtr<Panel> const & aPanel = *iPanel;
if (! aPanel->HasIdPredicate(mPanelId))
aPanel->SetExpanded(false);