X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FWordList.cpp;h=558ddf8a1872ff4b11d408fc1a33715453f59afd;hb=9337d73f1f9a6d4dae2e239e9f679a7452660c40;hp=30ba5b63afc379c5af77090e95f370f6279e4386;hpb=cd5bad62e039629d0642550b9cd64358104b0c66;p=lyx.git diff --git a/src/WordList.cpp b/src/WordList.cpp index 30ba5b63af..558ddf8a18 100644 --- a/src/WordList.cpp +++ b/src/WordList.cpp @@ -63,7 +63,12 @@ docstring const & WordList::word(size_t idx) const { Impl::Words::const_iterator it = d->words_.find_summed_weight(idx); BOOST_ASSERT(it != d->words_.end()); - return it->first; + + // We use the key() method here, and not something like it->first + // because the btree only returns (iterator-) temporary value pairs. + // If we returned the first component of those here, we get an + // invalid reference and therefore strange crashes. + return it.key(); }