[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - 2 commits - include/vcl sfx2/source vcl/source
Thorsten Behrens (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 7 12:34:24 UTC 2020
include/vcl/tabpage.hxx | 3 -
sfx2/source/sidebar/SidebarController.cxx | 23 +++++++--
sfx2/source/sidebar/SidebarPanelBase.cxx | 14 +++++
sfx2/source/sidebar/Theme.cxx | 20 +++++++
vcl/source/window/tabpage.cxx | 76 +++++++++++++-----------------
5 files changed, 89 insertions(+), 47 deletions(-)
New commits:
commit 05444104239f4c7ee5f8df8e96d8cbb8160bbb1e
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Thu Nov 19 14:00:57 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Dec 7 13:34:03 2020 +0100
fix tdf#138335 guard sidebar uno methods with SolarMutex
Wasn't threadsafe before; using vcl/gui code, so we need the
SolarMutex.
Conflicts:
sfx2/source/sidebar/SidebarController.cxx
Change-Id: I3d4407f095837d03ad492fcdf9a08746cf911d25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106169
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106211
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107137
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 739963e1c36e..e1e8b1e3e079 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -202,6 +202,8 @@ void SidebarController::disposeDecks()
void SAL_CALL SidebarController::disposing()
{
+ SolarMutexGuard aSolarMutexGuard;
+
mpCloseIndicator.disposeAndClear();
maFocusManager.Clear();
@@ -270,6 +272,8 @@ void SAL_CALL SidebarController::disposing()
void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::ContextChangeEventObject& rEvent)
{
+ SolarMutexGuard aSolarMutexGuard;
+
// Update to the requested new context asynchronously to avoid
// subtle errors caused by SFX2 which in rare cases can not
// properly handle a synchronous update.
@@ -282,7 +286,9 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
{
mxCurrentController.set(rEvent.Source, css::uno::UNO_QUERY);
maAsynchronousDeckSwitch.CancelRequest();
- maContextChangeUpdate.RequestCall();
+ maContextChangeUpdate.RequestCall(); // async call, not a prob
+ // calling with held
+ // solarmutex
// TODO: this call is redundant but mandatory for unit test to update context on document loading
UpdateConfigurations();
}
@@ -290,16 +296,24 @@ void SAL_CALL SidebarController::notifyContextChangeEvent (const css::ui::Contex
void SAL_CALL SidebarController::disposing (const css::lang::EventObject& )
{
+ SolarMutexGuard aSolarMutexGuard;
+
dispose();
}
void SAL_CALL SidebarController::propertyChange (const css::beans::PropertyChangeEvent& )
{
- maPropertyChangeForwarder.RequestCall();
+ SolarMutexGuard aSolarMutexGuard;
+
+ maPropertyChangeForwarder.RequestCall(); // async call, not a prob
+ // to call with held
+ // solarmutex
}
void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEvent& rEvent)
{
+ SolarMutexGuard aSolarMutexGuard;
+
bool bIsReadWrite (true);
if (rEvent.IsEnabled)
rEvent.State >>= bIsReadWrite;
@@ -314,12 +328,15 @@ void SAL_CALL SidebarController::statusChanged (const css::frame::FeatureStateEv
mnRequestedForceFlags |= SwitchFlag_ForceSwitch;
maAsynchronousDeckSwitch.CancelRequest();
- maContextChangeUpdate.RequestCall();
+ maContextChangeUpdate.RequestCall(); // async call, ok to call
+ // with held solarmutex
}
}
void SAL_CALL SidebarController::requestLayout()
{
+ SolarMutexGuard aSolarMutexGuard;
+
sal_Int32 nMinimalWidth = 0;
if (mpCurrentDeck && !mpCurrentDeck->isDisposed())
{
diff --git a/sfx2/source/sidebar/SidebarPanelBase.cxx b/sfx2/source/sidebar/SidebarPanelBase.cxx
index 7d0687462122..ea5c0497aa8e 100644
--- a/sfx2/source/sidebar/SidebarPanelBase.cxx
+++ b/sfx2/source/sidebar/SidebarPanelBase.cxx
@@ -79,6 +79,8 @@ SidebarPanelBase::~SidebarPanelBase()
void SAL_CALL SidebarPanelBase::disposing()
{
+ SolarMutexGuard aGuard;
+
mpControl.disposeAndClear();
if (mxFrame.is())
@@ -95,6 +97,8 @@ void SAL_CALL SidebarPanelBase::disposing()
void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
const ui::ContextChangeEventObject& rEvent)
{
+ SolarMutexGuard aGuard;
+
IContextChangeReceiver* pContextChangeReceiver
= dynamic_cast<IContextChangeReceiver*>(mpControl.get());
if (pContextChangeReceiver != nullptr)
@@ -109,6 +113,8 @@ void SAL_CALL SidebarPanelBase::notifyContextChangeEvent (
void SAL_CALL SidebarPanelBase::disposing (
const css::lang::EventObject&)
{
+ SolarMutexGuard aGuard;
+
mxFrame = nullptr;
mpControl = nullptr;
}
@@ -142,6 +148,8 @@ Reference<accessibility::XAccessible> SAL_CALL SidebarPanelBase::createAccessibl
Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow()
{
+ SolarMutexGuard aGuard;
+
if (mpControl != nullptr)
return Reference<awt::XWindow>(
mpControl->GetComponentInterface(),
@@ -152,6 +160,8 @@ Reference<awt::XWindow> SAL_CALL SidebarPanelBase::getWindow()
ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWidth)
{
+ SolarMutexGuard aGuard;
+
if (maLayoutSize.Minimum >= 0)
return maLayoutSize;
else
@@ -178,6 +188,8 @@ ui::LayoutSize SAL_CALL SidebarPanelBase::getHeightForWidth (const sal_Int32 nWi
sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth ()
{
+ SolarMutexGuard aGuard;
+
if (isLayoutEnabled(mpControl))
{
// widget layout-based sidebar
@@ -189,6 +201,8 @@ sal_Int32 SAL_CALL SidebarPanelBase::getMinimalWidth ()
void SAL_CALL SidebarPanelBase::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
{
+ SolarMutexGuard aGuard;
+
SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mpControl.get());
if (!pModelUpdate)
return;
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index e793c4c77e00..08c142e6ff4e 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -345,6 +345,8 @@ void Theme::UpdateTheme()
void SAL_CALL Theme::disposing()
{
+ SolarMutexGuard aGuard;
+
ChangeListeners aListeners;
aListeners.swap(maChangeListeners);
@@ -387,6 +389,8 @@ void SAL_CALL Theme::setPropertyValue (
const ::rtl::OUString& rsPropertyName,
const css::uno::Any& rValue)
{
+ SolarMutexGuard aGuard;
+
PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
if (iId == maPropertyNameToIdMap.end())
throw beans::UnknownPropertyException(rsPropertyName);
@@ -429,6 +433,8 @@ void SAL_CALL Theme::setPropertyValue (
Any SAL_CALL Theme::getPropertyValue (
const ::rtl::OUString& rsPropertyName)
{
+ SolarMutexGuard aGuard;
+
PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
if (iId == maPropertyNameToIdMap.end())
throw beans::UnknownPropertyException();
@@ -446,6 +452,8 @@ void SAL_CALL Theme::addPropertyChangeListener(
const ::rtl::OUString& rsPropertyName,
const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
{
+ SolarMutexGuard aGuard;
+
ThemeItem eItem (AnyItem_);
if (rsPropertyName.getLength() > 0)
{
@@ -468,6 +476,8 @@ void SAL_CALL Theme::removePropertyChangeListener(
const ::rtl::OUString& rsPropertyName,
const css::uno::Reference<css::beans::XPropertyChangeListener>& rxListener)
{
+ SolarMutexGuard aGuard;
+
ThemeItem eItem (AnyItem_);
if (rsPropertyName.getLength() > 0)
{
@@ -500,6 +510,8 @@ void SAL_CALL Theme::addVetoableChangeListener(
const ::rtl::OUString& rsPropertyName,
const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
{
+ SolarMutexGuard aGuard;
+
ThemeItem eItem (AnyItem_);
if (rsPropertyName.getLength() > 0)
{
@@ -522,6 +534,8 @@ void SAL_CALL Theme::removeVetoableChangeListener(
const ::rtl::OUString& rsPropertyName,
const css::uno::Reference<css::beans::XVetoableChangeListener>& rxListener)
{
+ SolarMutexGuard aGuard;
+
ThemeItem eItem (AnyItem_);
if (rsPropertyName.getLength() > 0)
{
@@ -551,6 +565,8 @@ void SAL_CALL Theme::removeVetoableChangeListener(
css::uno::Sequence<css::beans::Property> SAL_CALL Theme::getProperties()
{
+ SolarMutexGuard aGuard;
+
::std::vector<beans::Property> aProperties;
sal_Int32 const nEnd(End_);
@@ -576,6 +592,8 @@ css::uno::Sequence<css::beans::Property> SAL_CALL Theme::getProperties()
beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsPropertyName)
{
+ SolarMutexGuard aGuard;
+
PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
if (iId == maPropertyNameToIdMap.end())
throw beans::UnknownPropertyException();
@@ -595,6 +613,8 @@ beans::Property SAL_CALL Theme::getPropertyByName (const ::rtl::OUString& rsProp
sal_Bool SAL_CALL Theme::hasPropertyByName (const ::rtl::OUString& rsPropertyName)
{
+ SolarMutexGuard aGuard;
+
PropertyNameToIdMap::const_iterator iId (maPropertyNameToIdMap.find(rsPropertyName));
if (iId == maPropertyNameToIdMap.end())
return false;
commit 963cc1593fc7755d63d2e73806544fb9fd5c68c8
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Wed Nov 11 03:06:46 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Dec 7 13:33:51 2020 +0100
Create tabpage scrollbars only on demand
Otherwise glade-ui code gets confused to find controls
it never generated.
Change-Id: Iaf9a6e6aa5080f7a49bb754fe967e6a85e80cfae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105572
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107136
diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx
index 9e93de8f37a1..7a57ad17d4bd 100644
--- a/include/vcl/tabpage.hxx
+++ b/include/vcl/tabpage.hxx
@@ -49,8 +49,6 @@ private:
bool mbHasVertBar;
Point mnScrollPos;
long mnScrWidth;
- enum ScrollBarVisibility { None, Vert, Hori, Both };
- ScrollBarVisibility maScrollVis;
public:
explicit TabPage( vcl::Window* pParent, WinBits nStyle = 0 );
@@ -80,7 +78,6 @@ public:
void SetScrollHeight( long nHeight );
void SetScrollLeft( long nLeft );
void SetScrollTop( long Top );
- void setScrollVisibility( ScrollBarVisibility rState );
void ResetScrollBars();
};
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index dc714847bdbd..d5f220a7b1b6 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -37,35 +37,41 @@ void TabPage::ImplInit( vcl::Window* pParent, WinBits nStyle )
Window::ImplInit( pParent, nStyle, nullptr );
- ImplInitSettings();
-
- m_pVScroll.set(VclPtr<ScrollBar>::Create(this, ((nStyle & WB_VSCROLL) ? WB_HIDE : 0) | WB_VSCROLL | WB_DRAG));
- m_pHScroll.set(VclPtr<ScrollBar>::Create(this, ((nStyle & WB_HSCROLL) ? WB_HIDE : 0) | WB_HSCROLL | WB_DRAG));
- m_aScrollBarBox.set(
- VclPtr<ScrollBarBox>::Create(this,
- ((nStyle & (WB_VSCROLL|WB_HSCROLL)) ? WB_HIDE : 0)));
mbHasHoriBar = false;
mbHasVertBar = false;
- ScrollBarVisibility aVis = None;
+
+ Link<ScrollBar*,void> aLink( LINK( this, TabPage, ScrollBarHdl ) );
if ( nStyle & ( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) )
{
if ( nStyle & WB_AUTOHSCROLL )
- aVis = Hori;
+ {
+ mbHasHoriBar = true;
+ m_pHScroll.set(VclPtr<ScrollBar>::Create(this, (WB_HSCROLL | WB_DRAG)));
+ m_pHScroll->Show();
+ m_pHScroll->SetScrollHdl(aLink);
+ }
if ( nStyle & WB_AUTOVSCROLL )
{
- if ( aVis == Hori )
- aVis = Both;
- else
- aVis = Vert;
+ mbHasVertBar = true;
+ m_pVScroll.set(VclPtr<ScrollBar>::Create(this, (WB_VSCROLL | WB_DRAG)));
+ m_pVScroll->Show();
+ m_pVScroll->SetScrollHdl(aLink);
}
}
- setScrollVisibility( aVis );
+
+ if ( mbHasHoriBar || mbHasVertBar )
+ {
+ m_aScrollBarBox.set(
+ VclPtr<ScrollBarBox>::Create(this,
+ ((nStyle & (WB_VSCROLL|WB_HSCROLL)) ? WB_HIDE : 0)));
+ m_aScrollBarBox->Show();
+ SetStyle( GetStyle() | WB_CLIPCHILDREN );
+ }
+
mnScrWidth = Application::GetSettings().GetStyleSettings().GetScrollBarSize();
- Link<ScrollBar*,void> aLink( LINK( this, TabPage, ScrollBarHdl ) );
- m_pVScroll->SetScrollHdl(aLink);
- m_pHScroll->SetScrollHdl(aLink);
+ ImplInitSettings();
// if the tabpage is drawn (ie filled) by a native widget, make sure all controls will have transparent background
// otherwise they will paint with a wrong background
@@ -244,23 +250,6 @@ void TabPage::SetPosPixel(const Point& rAllocPos)
}
}
-void TabPage::setScrollVisibility( ScrollBarVisibility rVisState )
-{
- maScrollVis = rVisState;
- if ( maScrollVis == Hori || maScrollVis == Both )
- {
- mbHasHoriBar = true;
- m_pHScroll->Show();
- }
- if ( maScrollVis == Vert || maScrollVis == Both )
- {
- mbHasVertBar = true;
- m_pVScroll->Show();
- }
- if ( mbHasHoriBar || mbHasVertBar )
- SetStyle( GetStyle() | WB_CLIPCHILDREN );
-}
-
void TabPage::lcl_Scroll( long nX, long nY )
{
long nXScroll = mnScrollPos.X() - nX;
@@ -332,14 +321,19 @@ void TabPage::ResetScrollBars()
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
- m_pVScroll->SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
- m_pHScroll->SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
-
- m_pHScroll->SetRangeMax( maScrollArea.Width() + mnScrWidth );
- m_pHScroll->SetVisibleSize( GetSizePixel().Width() );
+ if( m_pVScroll )
+ {
+ m_pVScroll->SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
+ m_pVScroll->SetRangeMax( maScrollArea.Height() + mnScrWidth );
+ m_pVScroll->SetVisibleSize( GetSizePixel().Height() );
+ }
- m_pVScroll->SetRangeMax( maScrollArea.Height() + mnScrWidth );
- m_pVScroll->SetVisibleSize( GetSizePixel().Height() );
+ if( m_pHScroll )
+ {
+ m_pHScroll->SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
+ m_pHScroll->SetRangeMax( maScrollArea.Width() + mnScrWidth );
+ m_pHScroll->SetVisibleSize( GetSizePixel().Width() );
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list