Kaydet (Commit) 5059efab authored tarafından Sophie Su's avatar Sophie Su Kaydeden (comit) Michael Stahl

tdf#43157 clean up OSL_ASSERT in /core/sw/source/core/undo/docundo.cxx

Change-Id: I866ba17ffe82294758fd54c525c030eda1e0761a
Reviewed-on: https://gerrit.libreoffice.org/28418Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 6dee1b1a
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <IDocumentRedlineAccess.hxx> #include <IDocumentRedlineAccess.hxx>
#include <IDocumentState.hxx> #include <IDocumentState.hxx>
#include <comphelper/lok.hxx> #include <comphelper/lok.hxx>
#include <assert.h>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -64,7 +65,7 @@ UndoManager::UndoManager(std::shared_ptr<SwNodes> const & xUndoNodes, ...@@ -64,7 +65,7 @@ UndoManager::UndoManager(std::shared_ptr<SwNodes> const & xUndoNodes,
, m_pDocShell(nullptr) , m_pDocShell(nullptr)
, m_pView(nullptr) , m_pView(nullptr)
{ {
OSL_ASSERT(m_xUndoNodes.get()); assert(m_xUndoNodes.get());
// writer expects it to be disabled initially // writer expects it to be disabled initially
// Undo is enabled by SwEditShell constructor // Undo is enabled by SwEditShell constructor
SdrUndoManager::EnableUndo(false); SdrUndoManager::EnableUndo(false);
...@@ -271,13 +272,13 @@ UndoManager::StartUndo(SwUndoId const i_eUndoId, ...@@ -271,13 +272,13 @@ UndoManager::StartUndo(SwUndoId const i_eUndoId,
SwUndoId const eUndoId( (i_eUndoId == UNDO_EMPTY) ? UNDO_START : i_eUndoId ); SwUndoId const eUndoId( (i_eUndoId == UNDO_EMPTY) ? UNDO_START : i_eUndoId );
OSL_ASSERT(UNDO_END != eUndoId); assert(UNDO_END != eUndoId);
OUString comment( (UNDO_START == eUndoId) OUString comment( (UNDO_START == eUndoId)
? OUString("??") ? OUString("??")
: OUString(SW_RES(UNDO_BASE + eUndoId)) ); : OUString(SW_RES(UNDO_BASE + eUndoId)) );
if (pRewriter) if (pRewriter)
{ {
OSL_ASSERT(UNDO_START != eUndoId); assert(UNDO_START != eUndoId);
comment = pRewriter->Apply(comment); comment = pRewriter->Apply(comment);
} }
...@@ -313,12 +314,12 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) ...@@ -313,12 +314,12 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter)
if (nCount) // otherwise: empty list action not inserted! if (nCount) // otherwise: empty list action not inserted!
{ {
OSL_ASSERT(pLastUndo); assert(pLastUndo);
OSL_ASSERT(UNDO_START != eUndoId); assert(UNDO_START != eUndoId);
SfxUndoAction *const pUndoAction(SdrUndoManager::GetUndoAction()); SfxUndoAction *const pUndoAction(SdrUndoManager::GetUndoAction());
SfxListUndoAction *const pListAction( SfxListUndoAction *const pListAction(
dynamic_cast<SfxListUndoAction*>(pUndoAction)); dynamic_cast<SfxListUndoAction*>(pUndoAction));
OSL_ASSERT(pListAction); assert(pListAction);
if (pListAction) if (pListAction)
{ {
if (UNDO_END != eUndoId) if (UNDO_END != eUndoId)
...@@ -644,7 +645,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext, ...@@ -644,7 +645,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext,
return false; return false;
} }
SfxUndoAction *const pRepeatAction(GetUndoAction()); SfxUndoAction *const pRepeatAction(GetUndoAction());
OSL_ASSERT(pRepeatAction); assert(pRepeatAction);
if (!pRepeatAction || !pRepeatAction->CanRepeat(rContext)) if (!pRepeatAction || !pRepeatAction->CanRepeat(rContext))
{ {
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment