mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
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:
parent
b69f53cd0f
commit
22204cda0b
@ -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();
|
||||
|
@ -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();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user