git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25598 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-07-14 08:48:25 +00:00
parent 79beb91e3a
commit e61643b43b

View File

@ -17,6 +17,7 @@
#include "Buffer.h" #include "Buffer.h"
#include "buffer_funcs.h" #include "buffer_funcs.h"
#include "BufferList.h"
#include "BufferParams.h" #include "BufferParams.h"
#include "BufferView.h" #include "BufferView.h"
#include "Changes.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 // 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 // some kind of garbage collection there, or a shared_ptr, then this
// would not be needed. // would not be needed.
// FIXME: this cannot be static because it gets destructed after the main static Buffer * buffer = theBufferList().newBuffer("");
// LyX singleton is destroyed and the code is just not ready for that yet! buffer->setUnnamed(true);
//static Buffer buffer("", false); buffer->paragraphs() = paragraphs;
Buffer buffer("", false); buffer->params().setDocumentClass(docclass);
buffer.setUnnamed(true);
buffer.paragraphs() = paragraphs;
buffer.params().setDocumentClass(docclass);
ostringstream lyx; ostringstream lyx;
if (buffer.write(lyx)) if (buffer->write(lyx))
theClipboard().put(lyx.str(), plaintext); theClipboard().put(lyx.str(), plaintext);
else else
theClipboard().put(string(), plaintext); theClipboard().put(string(), plaintext);
// Save that memory // Save that memory
buffer.paragraphs().clear(); buffer->paragraphs().clear();
} }