From 6e7d9c4582c05eee47b0b455444e66b4f2445785 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 2 Oct 2019 14:31:59 +0100 Subject: Resolves: tdf#127904 modal depth dips below 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when validation dialog is run modally, but changed itself to unmodal during execution. only NotifyModalHierarchy on modal<->unmodal transition and not on modality depth Change-Id: I85d4f67e5b0426aafbf80b1ae25fc3e3f19717af Reviewed-on: https://gerrit.libreoffice.org/80039 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/unx/gtk3/gtk3gtkinst.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index e31fb2371bb3..7b5356bee72e 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3537,8 +3537,9 @@ struct DialogRunner if (m_xFrameWindow) { m_xFrameWindow->IncModalCount(); + if (m_nModalDepth == 0) + m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(true); ++m_nModalDepth; - m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(true); } } @@ -3548,7 +3549,8 @@ struct DialogRunner { m_xFrameWindow->DecModalCount(); --m_nModalDepth; - m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(false); + if (m_nModalDepth == 0) + m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(false); } } @@ -3608,13 +3610,8 @@ struct DialogRunner // if, like the calc validation dialog does, the modality was // toggled off during execution ensure that on cleanup the parent // is left in the state it was found - SalFrame* pFrame = m_xFrameWindow->ImplGetFrame(); - do - { + while (m_nModalDepth++ < 0) m_xFrameWindow->IncModalCount(); - pFrame->NotifyModalHierarchy(true); - } - while (++m_nModalDepth < 0); } } }; -- cgit