The branch, master, has been updated.

- Log -----------------------------------------------------------------

commit 928dc03324fc1271e3c5d8a82e00dd69ee740090
Author: Georg Baum <[email protected]>
Date:   Sun Apr 21 21:15:54 2013 +0200

    Fic crash for repeated pasting from complex docs
    
    Using a cloned buffer was an idea by Richard, and it works well.

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index 0ed82d6..cef66b5 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -478,12 +478,17 @@ void putClipboard(ParagraphList const & paragraphs,
        // to be so, but the alternative is to construct a new one of these 
(with a
        // new temporary directory, etc) every time, and then to destroy it. So 
maybe
        // it's worth just keeping this one around.
-       static Buffer * buffer = theBufferList().newInternalBuffer(
+       Buffer * staticbuffer = theBufferList().newInternalBuffer(
                FileName::tempName("clipboard.internal").absFileName());
 
        // These two things only really need doing the first time.
-       buffer->setUnnamed(true);
-       buffer->inset().setBuffer(*buffer);
+       staticbuffer->setUnnamed(true);
+       staticbuffer->inset().setBuffer(*staticbuffer);
+
+       // Use a clone for the complicated stuff so that we do not need to clean
+       // up in order to avoid a crash.
+       Buffer * buffer = staticbuffer->cloneBufferOnly();
+       LASSERT(buffer, return);
 
        // This needs doing every time.
        buffer->params().setDocumentClass(docclass);
@@ -521,7 +526,7 @@ void putClipboard(ParagraphList const & paragraphs,
        theClipboard().put(lyx, oshtml.str(), plaintext);
 
        // Save that memory
-       buffer->paragraphs().clear();
+       delete buffer;
 }
 
 

commit ed2f6a85998c22eab8b1237c4361ae3900d58f6a
Author: Georg Baum <[email protected]>
Date:   Sun Apr 21 20:45:56 2013 +0200

    Use MathML on the clipboard for formulas in HTML
    
    This speeds up the copying, and although not many applications understand
    MathML currently (MS word is supposed to understand it), their number should
    go up in the future.

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index d346361..0ed82d6 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -494,6 +494,11 @@ void putClipboard(ParagraphList const & paragraphs,
        ErrorList el;
        pasteSelectionHelper(dit, paragraphs, docclass, el);
 
+       // We don't want to produce images that are not used. Therefore,
+       // output formulas as MathML. Even if this is not understood by all
+       // applications, the number that can parse it should go up in the 
future.
+       buffer->params().html_math_output = BufferParams::MathML;
+
        // The Buffer is being used to export. This is necessary so that the
        // updateMacros call will record the needed information.
        MarkAsExporting mex(buffer);

-----------------------------------------------------------------------

Summary of changes:
 src/CutAndPaste.cpp |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to