verify that we hold the SolarMutex when ref-counting VclPtr

Change-Id: If0c5a8c99f0f853c9ecad0f1a4a7299d69805b34
Reviewed-on: https://gerrit.libreoffice.org/31755
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2016-12-08 13:55:54 +02:00
parent cee552d207
commit e794ce1eef
12 changed files with 19 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include <svx/charthelper.hxx>
#include <vcl/openglwin.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
@ -1425,6 +1426,7 @@ void ChartModel::setWindow( const sal_uInt64 nWindowPtr )
throw (uno::RuntimeException, std::exception)
{
OpenGLWindow* pWindow = reinterpret_cast<OpenGLWindow*>(nWindowPtr);
SolarMutexGuard aGuard;
mpOpenGLWindow = pWindow;
}

View File

@ -71,6 +71,7 @@ CloseDispatcher::CloseDispatcher(const css::uno::Reference< css::uno::XComponent
uno::Reference<awt::XWindow> xWindow = xTarget->getContainerWindow();
if (xWindow.is())
{
SolarMutexGuard g;
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (pWindow->IsSystemWindow())
m_pSysWindow = dynamic_cast<SystemWindow*>(pWindow.get());

View File

@ -2554,6 +2554,7 @@ void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn(
nCurrPos += ( aWinRect.Y - nCurrPos ) + aWinRect.Height;
}
}
pDockAreaWindow.clear(); // must be cleared under SolarMutex
}
void ToolbarLayoutManager::implts_setLayoutDirty()

View File

@ -1672,6 +1672,7 @@ void LoadEnv::impl_applyPersistentWindowState(const css::uno::Reference< css::aw
WorkWindow* pWorkWindow = static_cast<WorkWindow*>(pWindow.get());
if (pWorkWindow->IsMinimized())
return;
pWindow.clear(); // must be cleared under SolarMutex
aSolarGuard1.clear();
// <- SOLAR SAFE

View File

@ -876,6 +876,8 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >&
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
if (pWindow && pWindow->IsVisible())
m_bIsHidden = false;
// must be cleared while under the SolarMutex
pWindow.clear();
css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager = m_xLayoutManager;
@ -1542,6 +1544,7 @@ sal_Bool SAL_CALL Frame::setComponent(const css::uno::Reference< css::awt::XWind
css::uno::Reference< css::frame::XController > xOldController = m_xController;
VclPtr<vcl::Window> pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow );
bool bHadFocus = pOwnWindow->HasChildPathFocus();
pOwnWindow.clear(); // must be cleared under SolarMutex
bool bWasConnected = m_bConnected;
aReadLock.clear();
/* } SAFE */

View File

@ -222,6 +222,9 @@ MenuBarManager::~MenuBarManager()
m_aAsyncSettingsTimer.Stop();
SAL_WARN_IF( OWeakObject::m_refCount != 0, "fwk.uielement", "Who wants to delete an object with refcount > 0!" );
SolarMutexGuard aGuard;
m_pVCLMenu.clear();
}
void MenuBarManager::Destroy()

View File

@ -21,6 +21,7 @@
#include <vcl/dllapi.h>
#include <vcl/vclptr.hxx>
#include <tools/debug.hxx>
#include <cassert>
class VclReferenceBase;
@ -35,12 +36,14 @@ class VCL_DLLPUBLIC VclReferenceBase
public:
inline void acquire() const
{
DBG_TESTSOLARMUTEX();
assert(mnRefCnt>0);
mnRefCnt++;
}
inline void release() const
{
DBG_TESTSOLARMUTEX();
assert(mnRefCnt>0);
if (!--mnRefCnt)
delete this;

View File

@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,protocolhandler,\
fwe \
sal \
sfx \
tl \
vcl \
$(gb_UWINAPI) \
))

View File

@ -29,6 +29,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sdext_pdfimport,\
cppuhelper \
sal \
test \
tl \
unotest \
$(gb_UWINAPI) \
))

View File

@ -30,6 +30,7 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
unotest \
cppuhelper \
sal \
tl \
))
$(eval $(call gb_Executable_use_library_objects,pdf2xml,pdfimport))

View File

@ -28,6 +28,7 @@ $(eval $(call gb_Executable_use_libraries,pdfunzip,\
cppuhelper \
sal \
vcl \
tl \
))
$(eval $(call gb_Executable_use_library_objects,pdfunzip,pdfimport))

View File

@ -27,6 +27,7 @@ $(eval $(call gb_Library_use_libraries,pdfimport,\
cppu \
cppuhelper \
sal \
tl \
))
$(eval $(call gb_Library_use_externals,pdfimport,\