diff options
author | Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de> | 2024-03-26 18:35:21 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-04-04 20:51:21 +0200 |
commit | e074460a8240265d4948e4712fdc7a2d102449f2 (patch) | |
tree | 78b135122fbabc212fee1835a27f4e06eb893650 | |
parent | tdf#160301 import DOCVARIABLE fields as user fields (diff) | |
download | core-e074460a8240265d4948e4712fdc7a2d102449f2.tar.gz core-e074460a8240265d4948e4712fdc7a2d102449f2.zip |
IASS: Fix crash with PresenterConsole
When being in IASS mode and adding e.g. an effect to
a Shape (or anything else that triggers a preview)
and the PresenterConsole being active, we got a
crash. That happend due to the PresenterConsole
being initialized *twice* due to interpreting that
preview as SlideShow start. It also closed due to
interpreting the preview end as SlideShow end. The
next SlideShow end then bites the dust in an already
messed up situation.
To solve this, SlideshowImpl::startShowImpl now only
uses NotifyDocumentEvent "OnStartPresentation" when
this is not a SlideShow startup.
I also secured PresenterScreen using a local bool
to remember if it is initialized to avoid when that
would be done twice (also used for shutdown).
Change-Id: Ice588e0783fd39ec46d90a40affcaf2f789df8ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165356
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
-rw-r--r-- | sd/source/console/PresenterScreen.cxx | 28 | ||||
-rw-r--r-- | sd/source/console/PresenterScreen.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 17 |
3 files changed, 42 insertions, 6 deletions
diff --git a/sd/source/console/PresenterScreen.cxx b/sd/source/console/PresenterScreen.cxx index cd6c20d38cc5..64e8c8e11e5f 100644 --- a/sd/source/console/PresenterScreen.cxx +++ b/sd/source/console/PresenterScreen.cxx @@ -240,9 +240,17 @@ void SAL_CALL PresenterScreenListener::disposing (const css::lang::EventObject&) PresenterScreen::PresenterScreen ( const Reference<XComponentContext>& rxContext, css::uno::Reference<css::frame::XModel2> xModel) - : PresenterScreenInterfaceBase(m_aMutex), - mxModel(std::move(xModel)), - mxContextWeak(rxContext) +: PresenterScreenInterfaceBase(m_aMutex) +, mxModel(std::move(xModel)) +, mxController() +, mxConfigurationControllerWeak() +, mxContextWeak(rxContext) +, mpPresenterController() +, mxSavedConfiguration() +, mpPaneContainer() +, mxPaneFactory() +, mxViewFactory() +, mbIsInitialized(false) { } @@ -303,6 +311,10 @@ void SAL_CALL PresenterScreen::disposing (const lang::EventObject& /*rEvent*/) void PresenterScreen::InitializePresenterScreen() { + // IASS: already initialized (may even assert here?) + if (mbIsInitialized) + return; + try { Reference<XComponentContext> xContext (mxContextWeak); @@ -388,6 +400,9 @@ void PresenterScreen::InitializePresenterScreen() catch (const Exception&) { } + + // IASS: Remember we are initialized + mbIsInitialized = true; } void PresenterScreen::SwitchMonitors() @@ -545,6 +560,10 @@ Reference<drawing::framework::XResourceId> PresenterScreen::GetMainPaneId ( void PresenterScreen::RequestShutdownPresenterScreen() { + // IASS: only cleanup when we are initialized + if (!mbIsInitialized) + return; + // Restore the configuration that was active before the presenter screen // has been activated. Now, that the presenter screen is displayed in // its own top level window this probably not necessary, but one never knows. @@ -567,6 +586,9 @@ void PresenterScreen::RequestShutdownPresenterScreen() [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); }); xCC->update(); } + + // IASS: reset to non-initialized + mbIsInitialized = false; } void PresenterScreen::ShutdownPresenterScreen() diff --git a/sd/source/console/PresenterScreen.hxx b/sd/source/console/PresenterScreen.hxx index 0445311b9603..430384a45c6d 100644 --- a/sd/source/console/PresenterScreen.hxx +++ b/sd/source/console/PresenterScreen.hxx @@ -139,6 +139,9 @@ private: css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory; css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory; + // IASS: Flag to note if InitializePresenterScreen() was executed + bool mbIsInitialized; + class ViewDescriptor { public: diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 4987a598ae1a..8b5a5977c8cb 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -644,6 +644,8 @@ void SlideshowImpl::disposing(std::unique_lock<std::mutex>&) #ifdef ENABLE_SDREMOTE RemoteServer::presentationStopped(); #endif + // IASS: This is the central methodology to 'steer' the + // PresenterConsole - in this case, to shut it down if( mxShow.is() && mpDoc ) NotifyDocumentEvent( *mpDoc, @@ -1314,9 +1316,18 @@ bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProp mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) ); mxListenerProxy->addAsSlideShowListener(); - NotifyDocumentEvent( - *mpDoc, - "OnStartPresentation"); + // IASS: Do only startup the PresenterConsole if this is not + // the SlideShow Preview mode (else would be double) + if (!mbInterActiveSetup) + { + // IASS: This is the central methodology to 'steer' the + // PresenterConsole - in this case, to start it up and make + // it visible (if activated) + NotifyDocumentEvent( + *mpDoc, + "OnStartPresentation"); + } + displaySlideIndex( mpSlideController->getStartSlideIndex() ); return true; |