Abdelrazak Younes ha scritto:
Well, we discussed about adding a isInternal() function, but I would
rather see a patch beforehand than that I have to start fixing things
afterwards.
Well, in this case I told Tommaso about the TocBackend modification so
i understand that he felt that as an indication that it could commit
directly. IOW, this is probably my fault, not Tommaso's.
Sorry for this. Please, find attached an attempt to "repair".
Just the short-term work, not the long-term one you're discussing about.
On a related note, if you don't want to instantiate a tocBackend on an
internal buffer, I guess you may also desire that the internal buffer
knows that it is internal when it is constructed, i.e., adding a
parameter to the constructor (unless you want to rework a normal buffer
as an extension of an internal buffer which adds support for TOC and who
knows what else...).
I'm aware there are still crashes when displaying (or interacting with)
the toc. I hope I manage to make it stable in the next days.
T.
--
Tommaso Cucinotta, Computer Engineering PhD, Researcher
ReTiS Lab, Scuola Superiore Sant'Anna, Pisa, Italy
Tel +39 050 882 024, Fax +39 050 882 003
http://feanor.sssup.it/~tommaso
Index: src/TocBackend.cpp
===================================================================
--- src/TocBackend.cpp (revisione 31361)
+++ src/TocBackend.cpp (copia locale)
@@ -162,11 +162,10 @@
void TocBackend::update()
{
+ LASSERT(! buffer_->isInternal(), /**/);
tocs_.clear();
- if (! buffer_->isInternal()) {
- DocIterator dit;
- buffer_->inset().addToToc(dit);
- }
+ DocIterator dit;
+ buffer_->inset().addToToc(dit);
}
Index: src/Cursor.cpp
===================================================================
--- src/Cursor.cpp (revisione 31361)
+++ src/Cursor.cpp (copia locale)
@@ -2250,6 +2250,9 @@
void Cursor::checkBufferStructure()
{
+ if (buffer()->isInternal())
+ return;
+
Buffer const * master = buffer()->masterBuffer();
master->tocBackend().updateItem(*this);
if (master != buffer() && !master->hasGuiDelegate())