[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue May 3 13:09:25 PDT 2011
sc/source/core/data/document.cxx | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
New commits:
commit d53ec5342f018f7c766e47bf67aefebd3fe76d6a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue May 3 16:05:44 2011 -0400
fdo#36746: Prevent crash during sort.
This was indirectly caused by the change in SfxUndoManager, to keep
track of lock count to allow nested enabling / disabling of undo
operations. Because of this, it's very important to not enable /
disable unless it's currently disabled / enabled, respectively.
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bb881a0..6370b66 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5422,7 +5422,22 @@ void ScDocument::SetSubTotalCellsDirty(const ScRange& rDirtyRange)
void ScDocument::EnableUndo( bool bVal )
{
- GetUndoManager()->EnableUndo(bVal);
+ // The undo manager increases lock count every time undo is disabled.
+ // Because of this, we shouldn't disable undo unless it's currently
+ // enabled, or else re-enabling it may not actually re-enable undo unless
+ // the lock count becomes zero.
+
+ if (bVal)
+ {
+ if (!GetUndoManager()->IsUndoEnabled())
+ GetUndoManager()->EnableUndo(true);
+ }
+ else
+ {
+ if (GetUndoManager()->IsUndoEnabled())
+ GetUndoManager()->EnableUndo(false);
+ }
+
mbUndoEnabled = bVal;
}
More information about the Libreoffice-commits
mailing list