Blob Blame History Raw
From 637d80a4aebf2b65a855283a68e6dd72e9d6de30 Mon Sep 17 00:00:00 2001
From: Michael Stahl <mstahl@redhat.com>
Date: Mon, 6 Feb 2012 22:01:27 +0100
Subject: [PATCH 1/4] fdo#38745: fix hilariously stupid stack guards:

The UndoRedoRedlineGuards that SwUndo::{Un,Re}doWithContext wants to
put on the stack aren't actually variables, so the destructor gets
invoked before the function call that the guard is supposed to protect.
Regression from CWS undoapi.
(cherry picked from commit 13424b43c25389e303774c3fb2f2beb3e20ceae5)

Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
---
 sw/source/core/undo/undobj.cxx |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 60eaaf3..1645b32 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -251,7 +251,7 @@ void SwUndo::UndoWithContext(SfxUndoContext & rContext)
             dynamic_cast< ::sw::UndoRedoContext * >(& rContext));
     OSL_ASSERT(pContext);
     if (!pContext) { return; }
-    UndoRedoRedlineGuard(*pContext, *this);
+    UndoRedoRedlineGuard const g(*pContext, *this);
     UndoImpl(*pContext);
 }
 
@@ -261,7 +261,7 @@ void SwUndo::RedoWithContext(SfxUndoContext & rContext)
             dynamic_cast< ::sw::UndoRedoContext * >(& rContext));
     OSL_ASSERT(pContext);
     if (!pContext) { return; }
-    UndoRedoRedlineGuard(*pContext, *this);
+    UndoRedoRedlineGuard const g(*pContext, *this);
     RedoImpl(*pContext);
 }
 
-- 
1.7.7.6