The mixing of internal and 'normal' buffers turned out to be problematic. This commit just dissociates the two types.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26884 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-10-13 20:40:58 +00:00
parent b69f53cd0f
commit 22204cda0b
4 changed files with 23 additions and 11 deletions

View File

@ -277,6 +277,11 @@ Buffer::~Buffer()
// GuiView already destroyed
gui_ = 0;
if (d->unnamed && d->filename.extension() == "internal") {
// No need to do additional cleanups for internal buffer.
delete d;
return;
}
// loop over children
Impl::BufferPositionMap::iterator it = d->children_positions.begin();

View File

@ -51,6 +51,15 @@ BufferList::BufferList()
{}
BufferList::~BufferList()
{
BufferStorage::iterator it = binternal.begin();
BufferStorage::iterator end = binternal.end();
for (; it != end; ++it)
delete (*it);
}
bool BufferList::empty() const
{
return bstore.empty();
@ -110,8 +119,12 @@ Buffer * BufferList::newBuffer(string const & s, bool const ronly)
}
}
tmpbuf->params().useClassDefaults();
LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size());
bstore.push_back(tmpbuf.get());
if (tmpbuf->fileName().extension() == "internal") {
binternal.push_back(tmpbuf.get());
} else {
LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size());
bstore.push_back(tmpbuf.get());
}
return tmpbuf.release();
}
@ -169,8 +182,6 @@ Buffer * BufferList::next(Buffer const * buf) const
LASSERT(it != bstore.end(), /**/);
++it;
Buffer * nextbuf = (it == bstore.end()) ? bstore.front() : *it;
if (nextbuf->fileName().extension() == "internal")
return next(nextbuf);
return nextbuf;
}
@ -186,8 +197,6 @@ Buffer * BufferList::previous(Buffer const * buf) const
LASSERT(it != bstore.end(), /**/);
Buffer * previousbuf = (it == bstore.begin()) ? bstore.back() : *(it - 1);
if (previousbuf->fileName().extension() == "internal")
return previous(previousbuf);
return previousbuf;
}

View File

@ -38,6 +38,7 @@ public:
public:
BufferList();
~BufferList();
iterator begin();
const_iterator begin() const;
@ -122,6 +123,8 @@ private:
/// storage of all buffers
BufferStorage bstore;
/// storage of all internal buffers used for cut&paste, etc.
BufferStorage binternal;
};
/// Implementation is in LyX.cpp

View File

@ -680,11 +680,6 @@ void MenuDefinition::expandDocuments()
// We cannot use a for loop as the buffer list cycles.
do {
QString label = toqstr(b->fileName().displayName(20));
if (b->isUnnamed() && label.endsWith(".internal")) {
// This is an internal Buffer (eg. for clipboard operations)
b = theBufferList().next(b);
continue;
}
if (!b->isClean())
label += "*";
if (ii < 10)