sd/source/ui/inc/DrawController.hxx | 4 ++-- sd/source/ui/unoidl/DrawController.cxx | 9 ++++----- sd/source/ui/view/drviews5.cxx | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-)
New commits: commit 3cb0678a9cac9a681903b5a082d1c5dd5f25f665 Author: Noel Grandin <[email protected]> AuthorDate: Tue Mar 4 15:37:15 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Mar 5 10:24:25 2025 +0100 fix dodgy DrawController::fireChangeLayer code wow. just wow. So this "worked" previously by virture of the fact that we were storing a pointer to something on the stack, and it would have fired almost all of the time, so mostly the symptom would be unnecessary screen updates. Of course, sometimes, by accident, two things on the stack would end up in the same location and the firing would not happen, leading to a temporary screen glitch. Change-Id: Iea85520ce1a2f522a0d63a57fbd14017d1bb349c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182482 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx index 4dc81feca3af..147ff0c1a1c1 100644 --- a/sd/source/ui/inc/DrawController.hxx +++ b/sd/source/ui/inc/DrawController.hxx @@ -139,7 +139,7 @@ public: */ void BroadcastContextChange() const; void NotifyAccUpdate(); - void fireChangeLayer( css::uno::Reference< css::drawing::XLayer>* pCurrentLayer ) noexcept; + void fireChangeLayer( const css::uno::Reference< css::drawing::XLayer>& xNewLayer ) noexcept; // change the parameter to int //void fireSwitchCurrentPage( String pageName) throw(); void fireSwitchCurrentPage( sal_Int32 pageIndex) noexcept; @@ -279,7 +279,7 @@ private: using cppu::OPropertySetHelper::disposing; using cppu::OPropertySetHelper::getFastPropertyValue; - css::uno::Reference< css::drawing::XLayer>* mpCurrentLayer; + css::uno::Reference< css::drawing::XLayer> mxCurrentLayer; const css::uno::Type m_aSelectionTypeIdentifier; diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 24232a6967a5..c3031a8f232c 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -61,7 +61,6 @@ DrawController::DrawController (ViewShellBase& rBase) noexcept : DrawControllerInterfaceBase(&rBase), BroadcastHelperOwner(SfxBaseController::m_aMutex), OPropertySetHelper(BroadcastHelperOwner::maBroadcastHelper), - mpCurrentLayer(nullptr), m_aSelectionTypeIdentifier( cppu::UnoType<view::XSelectionChangeListener>::get()), mpBase(&rBase), @@ -452,19 +451,19 @@ void DrawController::NotifyAccUpdate() fire (&nHandle, &aNewValue, &aOldValue, 1, false); } -void DrawController::fireChangeLayer( css::uno::Reference< css::drawing::XLayer>* pCurrentLayer ) noexcept +void DrawController::fireChangeLayer( const css::uno::Reference< css::drawing::XLayer>& xNewLayer ) noexcept { - if( pCurrentLayer != mpCurrentLayer ) + if( xNewLayer != mxCurrentLayer ) { sal_Int32 nHandle = PROPERTY_ACTIVE_LAYER; - Any aNewValue ( *pCurrentLayer); + Any aNewValue ( *xNewLayer); Any aOldValue ; fire (&nHandle, &aNewValue, &aOldValue, 1, false); - mpCurrentLayer = pCurrentLayer; + mxCurrentLayer = xNewLayer; } } diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx index aecdd6064a18..e8e38674eebd 100644 --- a/sd/source/ui/view/drviews5.cxx +++ b/sd/source/ui/view/drviews5.cxx @@ -631,7 +631,7 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex) *this, *GetView())); css::uno::Reference< css::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer(); - GetViewShellBase().GetDrawController()->fireChangeLayer( &rLayer ); + GetViewShellBase().GetDrawController()->fireChangeLayer( rLayer ); } }
