On Tue, Nov 02, 2021 at 10:07:20PM +0100, Pavel Sanda wrote:
> We call various reset() and clear() routines many many times,
> and its unclear to me why we repeatedlt call the whole machinery.

>From what I can see in the code the route to touching toc_ is:
Guiview::structureChanged() ->
                TocModels::reset ->
                                TocModel::reset
                                TocModels::clear -> TocModel::clear

and structureChanged() get's called way more often than in the case of document
change, for example in the case of just getting focus on the lyx window or
in the case of opening empty new window (ironically the document itself is in
readonly mode).

So the likely scenario is that the moment new window is created the toc_ in the
old one gets emptied via the route above, the we load the old document in
new window which in chain of events also triggers filterContents in the old
window and you're done.


I am afraid unless we want to revamp the whole toc update machinery we just
shouldn't by default that expect toc_ is nonempty.

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to