]> git.lyx.org Git - lyx.git/commitdiff
Fix again http://bugzilla.lyx.org/show_bug.cgi?id=5010
authorAbdelrazak Younes <younes@lyx.org>
Mon, 14 Jul 2008 08:48:25 +0000 (08:48 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 14 Jul 2008 08:48:25 +0000 (08:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25598 a592a061-630c-0410-9148-cb99ea01b6c8

src/CutAndPaste.cpp

index 3b54dc890ae1e597d83786ef00f7a030b4df085e..eb70bb8e1e89005bfae2a7831e871562fabef7c5 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "Buffer.h"
 #include "buffer_funcs.h"
+#include "BufferList.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Changes.h"
@@ -365,20 +366,17 @@ void putClipboard(ParagraphList const & paragraphs,
        // a DocumentClass, via new, that is never deleted. If we were to go to
        // some kind of garbage collection there, or a shared_ptr, then this
        // would not be needed.
-       // FIXME: this cannot be static because it gets destructed after the main
-       // LyX singleton is destroyed and the code is just not ready for that yet!
-       //static Buffer buffer("", false);
-       Buffer buffer("", false);
-       buffer.setUnnamed(true);
-       buffer.paragraphs() = paragraphs;
-       buffer.params().setDocumentClass(docclass);
+       static Buffer * buffer = theBufferList().newBuffer("");
+       buffer->setUnnamed(true);
+       buffer->paragraphs() = paragraphs;
+       buffer->params().setDocumentClass(docclass);
        ostringstream lyx;
-       if (buffer.write(lyx))
+       if (buffer->write(lyx))
                theClipboard().put(lyx.str(), plaintext);
        else
                theClipboard().put(string(), plaintext);
        // Save that memory
-       buffer.paragraphs().clear();
+       buffer->paragraphs().clear();
 }