]> git.lyx.org Git - lyx.git/blobdiff - src/WordList.cpp
Don try to be smart and always protect the preamble with \makeatletter
[lyx.git] / src / WordList.cpp
index 30ba5b63afc379c5af77090e95f370f6279e4386..7dc620e0898e2fba99101d23a546021b118982bf 100644 (file)
@@ -17,7 +17,7 @@
 #include "support/docstring.h"
 #include "support/weighted_btree.h"
 
-#include <boost/assert.hpp>
+#include "support/lassert.h"
 
 namespace lyx {
 
@@ -62,8 +62,13 @@ WordList::~WordList()
 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;
+       LASSERT(it != d->words_.end(), /**/);
+       
+       // 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();
 }