On 06/04/2013 19:01, Richard Heck wrote:
Consider this function:
TextMetrics & BufferView::textMetrics(Text const * t)
{
LASSERT(t, /**/);
TextMetricsCache::iterator tmc_it = d->text_metrics_.find(t);
if (tmc_it == d->text_metrics_.end()) {
tmc_it = d->text_metrics_.insert(
make_pair(t, TextMetrics(this, const_cast<Text
*>(t)))).first;
}
return tmc_it->second;
}
Probably, the only way we get an assertion here is (a) someone did
something very stupid or (b) we have some kind of memory corruption.
It seems to me that, in this kind of case, perhaps the best thing for
us to do is:
LASSERT(t, emergencyCleanup());
We will end up there anyway, so perhaps it is better just to do it
before things get worse.
That is my thinking, anyway.
Looks sensible.
Abdel.