Andre Poenitz wrote:
On Wed, Jul 09, 2008 at 06:43:53PM -0400, rgheck wrote:
        /// Only used in case of full backups
-       BufferParams bparams;
+       BufferParams & bparams;

I know it was my doing at some point of time, but can't bparams be
a plain pointer similar to the MathData and the ParagraphList we
have already in there?

That was my question of yesterday.

 Can a UndoElement outlive it's buffer?
I think it can't and if it can then there's a design problem. The attached patch works fine for me.

Abdel.

Andre'



Index: src/Undo.cpp
===================================================================
--- src/Undo.cpp        (revision 25531)
+++ src/Undo.cpp        (working copy)
@@ -73,7 +73,7 @@
                    MathData * ar, BufferParams const & bp, 
                    bool ifb) :
                kind(kin), cursor(cur), cell(cel), from(fro), end(en),
-               pars(pl), array(ar), bparams(bp), isFullBuffer(ifb)
+               pars(pl), array(ar), bparams(&bp), isFullBuffer(ifb)
        {}
        /// Which kind of operation are we recording for?
        UndoKind kind;
@@ -90,7 +90,7 @@
        /// the contents of the saved MathData (for mathed)
        MathData * array;
        /// Only used in case of full backups
-       BufferParams bparams;
+       BufferParams const * bparams;
        /// Only used in case of full backups
        bool isFullBuffer;
 private:
@@ -321,8 +321,8 @@
        if (undo.isFullBuffer) {
                LASSERT(undo.pars, /**/);
                // This is a full document
-               otherstack.top().bparams = buffer_.params();
-               buffer_.params() = undo.bparams;
+               otherstack.top().bparams = &buffer_.params();
+               buffer_.params() = *undo.bparams;
                swap(buffer_.paragraphs(), *undo.pars);
                delete undo.pars;
                undo.pars = 0;

Reply via email to