From 44f6a3e9583357ac882f1660285214231961204a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 11:45:22 +0100 Subject: vcl: Use existing PopupMenu::ImplGetFloatingWindow ... instead of manually casting the `m_pWindow` member in another place. While at it, also just call GetWindow() in PopupMenu::ImplGetFloatingWindow, not explicitly the base class Menu::ImplGetFloatingWindow. Both are the same, as this is a non-virtual method only implemented in the base class. Change-Id: I12debc7c5bad8b21722fabb093cbc4a7a669dff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177672 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 2 +- vcl/source/window/menufloatingwindow.cxx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'vcl/source') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 80f14042b0b7..300ecf535980 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2727,7 +2727,7 @@ int MenuBar::GetMenuBarHeight() const // bool PopupMenu::bAnyPopupInExecute = false; MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { - return static_cast(Menu::GetWindow()); + return static_cast(GetWindow()); } PopupMenu::PopupMenu() diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 64fba7d7a4f6..0d6a60689c35 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -482,9 +482,11 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) if ( !pActivePopup || ( pThisOnly && ( pThisOnly != pActivePopup ) ) ) return; - if (pActivePopup->m_pWindow) - if (static_cast(pActivePopup->m_pWindow.get())->IsInCleanUp()) + if (MenuFloatingWindow* pFloatWin = pActivePopup->ImplGetFloatingWindow()) + { + if (pFloatWin->IsInCleanUp()) return; // kill it later + } if ( pActivePopup->bInCallback ) pActivePopup->bCanceled = true; -- cgit