summaryrefslogtreecommitdiff
path: root/framework/source/loadenv/loadenv.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-10 12:53:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-11 06:55:41 +0000
commit78b4a1fb01af9ad3b3395a22f6e396be914b553e (patch)
tree846fdaea907a70fdc274a1e76642ed5e06622c0d /framework/source/loadenv/loadenv.cxx
parent071e23fee07b92b8f07800cda3ca7e66afe818ae (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/source/loadenv/loadenv.cxx')
-rw-r--r--framework/source/loadenv/loadenv.cxx16
1 files changed, 8 insertions, 8 deletions
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
}