- TocList const & toc_list = buf->tocBackend().tocs();
- TocList::const_iterator cit = toc_list.begin();
- TocList::const_iterator end = toc_list.end();
- for (; cit != end; ++cit) {
+ // In the navigation menu, only add tocs from this document
+ TocBackend const & backend = buf->tocBackend();
+ TocList const & toc_list = backend.tocs();
+ for (pair<string, shared_ptr<Toc>> const & toc : toc_list) {