summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2021-07-20 16:12:26 +0200
committerEike Rathke <erack@redhat.com>2021-08-16 17:09:21 +0200
commit4ecb94da9fdd00f24b02020151ac4d27d5514d5f (patch)
tree9148388af0ec4dfaad4b4df1c35a88bd3c0ef43b /framework
parent617fc3a0ed28b0ccc7fa658e4ba13a0fc9fb353b (diff)
Resolves: tdf#142980 Special-case the very first listener added during action
Change-Id: I8bc3475581d9525db8e83bc1551326c474e752bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119275 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/fwe/helper/undomanagerhelper.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx
index a621a39ae320..33d1fade47c7 100644
--- a/framework/source/fwe/helper/undomanagerhelper.cxx
+++ b/framework/source/fwe/helper/undomanagerhelper.cxx
@@ -210,6 +210,7 @@ namespace framework
IUndoManagerImplementation& m_rUndoManagerImplementation;
::std::stack< bool > m_aContextVisibilities;
#if OSL_DEBUG_LEVEL > 0
+ bool m_bContextAPIFlagsEverPushed = {false};
::std::stack< bool > m_aContextAPIFlags;
#endif
::std::queue< ::rtl::Reference< UndoManagerRequest > >
@@ -797,6 +798,7 @@ namespace framework
{
#if OSL_DEBUG_LEVEL > 0
m_aContextAPIFlags.push( m_bAPIActionRunning );
+ m_bContextAPIFlagsEverPushed = true;
#endif
if ( m_bAPIActionRunning )
@@ -808,9 +810,18 @@ namespace framework
void UndoManagerHelper_Impl::listActionLeft( const OUString& i_comment )
{
#if OSL_DEBUG_LEVEL > 0
- const bool bCurrentContextIsAPIContext = m_aContextAPIFlags.top();
- m_aContextAPIFlags.pop();
- OSL_ENSURE( bCurrentContextIsAPIContext == m_bAPIActionRunning, "UndoManagerHelper_Impl::listActionLeft: API and non-API contexts interwoven!" );
+ // It may happen that the very first event listener is added during a
+ // list action after listActionEntered() was already called, e.g. Calc
+ // formula calculation event listener during the input of the very
+ // first formula. Instead of checking m_aContextAPIFlags for empty,
+ // still assert (on calling top()) other stack mismatches but ignore
+ // this one case. See tdf#142980
+ if (m_bContextAPIFlagsEverPushed)
+ {
+ const bool bCurrentContextIsAPIContext = m_aContextAPIFlags.top();
+ m_aContextAPIFlags.pop();
+ OSL_ENSURE( bCurrentContextIsAPIContext == m_bAPIActionRunning, "UndoManagerHelper_Impl::listActionLeft: API and non-API contexts interwoven!" );
+ }
#endif
if ( m_bAPIActionRunning )