diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-11-23 08:54:58 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-11-23 17:35:26 +0100 |
commit | f5137ed5453661d21e85ecb94a08cfccae899ca1 (patch) | |
tree | 5d889605628b8617f202829e3378be68fd1bd971 /vcl | |
parent | 90ce07f5afcf52fc1ad7a9e636c8409af2d05913 (diff) |
only call signal_closed from Popdown dtor if it is still open
Change-Id: I251239a6ebbd3f55b68a0c2cb15b4bd6728e19c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125703
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 15 |
3 files changed, 23 insertions, 5 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index f26950fb42a6..b91ccb26cb7f 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1898,6 +1898,8 @@ private: DECL_LINK(PopupModeEndHdl, FloatingWindow*, void); + void ImplPopDown(); + public: SalInstancePopover(DockingWindow* pPopover, SalInstanceBuilder* pBuilder, bool bTakeOwnership); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e8f51950b04f..78148cd10ea8 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -6696,7 +6696,12 @@ SalInstancePopover::SalInstancePopover(DockingWindow* pPopover, SalInstanceBuild { } -SalInstancePopover::~SalInstancePopover() { signal_closed(); } +SalInstancePopover::~SalInstancePopover() +{ + DockingManager* pDockingManager = vcl::Window::GetDockingManager(); + if (pDockingManager->IsInPopupMode(m_xPopover)) + ImplPopDown(); +} void SalInstancePopover::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, weld::Placement ePlace) @@ -6726,13 +6731,15 @@ void SalInstancePopover::popup_at_rect(weld::Widget* pParent, const tools::Recta pDockingManager->StartPopupMode(m_xPopover, aRect, nFlags); } -void SalInstancePopover::popdown() +void SalInstancePopover::ImplPopDown() { vcl::Window::GetDockingManager()->EndPopupMode(m_xPopover); m_xPopover->EnableDocking(false); signal_closed(); } +void SalInstancePopover::popdown() { ImplPopDown(); } + IMPL_LINK_NOARG(SalInstancePopover, PopupModeEndHdl, FloatingWindow*, void) { signal_closed(); } SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b3dab5b14ef5..0fc8ffd9366c 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -22195,17 +22195,26 @@ public: gtk_popover_popdown(m_pPopover); } + void PopdownAndFlushClosedSignal() + { + if (get_visible()) + popdown(); + if (m_pClosedEvent) + { + Application::RemoveUserEvent(m_pClosedEvent); + async_signal_closed(nullptr); + } + } + virtual ~GtkInstancePopover() override { + PopdownAndFlushClosedSignal(); DisconnectMouseEvents(); #if !GTK_CHECK_VERSION(4, 0, 0) if (m_pMenuHack) gtk_widget_destroy(GTK_WIDGET(m_pMenuHack)); #endif - if (m_pClosedEvent) - Application::RemoveUserEvent(m_pClosedEvent); g_signal_handler_disconnect(m_pPopover, m_nSignalId); - signal_closed(); } }; |