sd/source/ui/sidebar/LayoutMenu.cxx | 29 ++--------------------------- sd/source/ui/sidebar/LayoutMenu.hxx | 6 ------ 2 files changed, 2 insertions(+), 33 deletions(-)
New commits: commit 2e12e22d562156059513868cfa84601ee8348f06 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jan 21 11:15:40 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jan 22 18:00:55 2026 +0100 sd: Move LayoutMenu::Dispose logic into dtor While LayoutMenu::Dispose is a public method, it only ever gets called from the own dtor. Therefore, move the relevant logic right into the dtor. Checking LayoutMenu::mbIsDisposed is unnecessary, as it's initialized to false and only gets set in LayoutMenu::Dispose itself, so it would never get set before the dtor gets called. Also drop SAL_INFOs only indicating that methods have been called. Change-Id: I0b9d38617b6da383fed1fc3a789956c13d0e1149 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197737 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 2c513978b4e3..0a99ef3d0d35 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -135,7 +135,6 @@ LayoutMenu::LayoutMenu ( mxLayoutIconView(m_xBuilder->weld_icon_view(u"layoutpanel_icons"_ustr)), mbIsMainViewChangePending(false), mxSidebar(std::move(xSidebar)), - mbIsDisposed(false), maPreviewSize(0, 0), bInContextMenuOperation(false) { @@ -157,26 +156,14 @@ LayoutMenu::LayoutMenu ( LayoutMenu::~LayoutMenu() { - SAL_INFO("sd.ui", "destroying LayoutMenu at " << this); - Dispose(); - mxLayoutIconView.reset(); -} - -void LayoutMenu::Dispose() -{ - if (mbIsDisposed) - return; - - SAL_INFO("sd.ui", "disposing LayoutMenu at " << this); - - mbIsDisposed = true; - if (mxListener.is()) mxListener->dispose(); Clear(); Link<sdtools::EventMultiplexerEvent&,void> aLink (LINK(this,LayoutMenu,EventMultiplexerListener)); mrBase.GetEventMultiplexer()->RemoveEventListener (aLink); + + mxLayoutIconView.reset(); } AutoLayout LayoutMenu::GetSelectedAutoLayout() const diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index b9f2f5f87519..2632350a8a30 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -64,8 +64,6 @@ public: css::uno::Reference<css::ui::XSidebar> xSidebar); virtual ~LayoutMenu() override; - void Dispose(); - /** Return a numerical value representing the currently selected layout. */ @@ -99,7 +97,6 @@ private: rtl::Reference<::sdtools::SlotStateListener> mxListener; bool mbIsMainViewChangePending; css::uno::Reference<css::ui::XSidebar> mxSidebar; - bool mbIsDisposed; // Store the size of preview image Size maPreviewSize; commit 4e2756a18ead5ef60eb98ac2a298cf2744b22051 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jan 21 11:08:36 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jan 22 18:00:48 2026 +0100 sd: Merge LayoutMenu::implConstruct into ctor ... and drop the SAL_INFO that the ctor is getting called, which isn't of general interest. Change-Id: I5a943a6c100758774e2dc39f3bfe3b9eada9212c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197736 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index a946d23f2536..2c513978b4e3 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -138,13 +138,6 @@ LayoutMenu::LayoutMenu ( mbIsDisposed(false), maPreviewSize(0, 0), bInContextMenuOperation(false) -{ - implConstruct(); - SAL_INFO("sd.ui", "created LayoutMenu at " << this); - -} - -void LayoutMenu::implConstruct() { mxLayoutIconView->connect_item_activated(LINK(this, LayoutMenu, LayoutSelected)); mxLayoutIconView->connect_command(LINK(this, LayoutMenu, CommandHdl)); diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index 92fbf76eafca..b9f2f5f87519 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -151,9 +151,6 @@ private: */ void UpdateSelection(); - // internal ctor - void implConstruct(); - void MenuSelect(const OUString& rIdent); /** When clicked then set the current page of the view in the center pane. commit 1bff4fcc0b9b30aa9a787130f374503ef3e4fee3 Author: Michael Weghorn <[email protected]> AuthorDate: Wed Jan 21 11:07:14 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jan 22 18:00:41 2026 +0100 sd: Drop unused LayoutMenu::implConstruct param The OSL_ENSURE doesn't add much value, because that is exactly the value the ctor as the only caller passes. Change-Id: I5b45c803c8cc45f3830c2723127a5d8195ad14ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197735 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index ec13f98910e6..a946d23f2536 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -139,18 +139,13 @@ LayoutMenu::LayoutMenu ( maPreviewSize(0, 0), bInContextMenuOperation(false) { - implConstruct( *mrBase.GetDocument()->GetDocSh() ); + implConstruct(); SAL_INFO("sd.ui", "created LayoutMenu at " << this); } -void LayoutMenu::implConstruct( DrawDocShell& rDocumentShell ) +void LayoutMenu::implConstruct() { - OSL_ENSURE( mrBase.GetDocument()->GetDocSh() == &rDocumentShell, - "LayoutMenu::implConstruct: hmm?" ); - // if this fires, then my assumption that the rDocumentShell parameter to our first ctor is superfluous ... - (void) rDocumentShell; - mxLayoutIconView->connect_item_activated(LINK(this, LayoutMenu, LayoutSelected)); mxLayoutIconView->connect_command(LINK(this, LayoutMenu, CommandHdl)); InvalidateContent(); diff --git a/sd/source/ui/sidebar/LayoutMenu.hxx b/sd/source/ui/sidebar/LayoutMenu.hxx index 67afecf595ec..92fbf76eafca 100644 --- a/sd/source/ui/sidebar/LayoutMenu.hxx +++ b/sd/source/ui/sidebar/LayoutMenu.hxx @@ -152,7 +152,7 @@ private: void UpdateSelection(); // internal ctor - void implConstruct(DrawDocShell& rDocumentShell); + void implConstruct(); void MenuSelect(const OUString& rIdent);
