]> git.lyx.org Git - features.git/commitdiff
Fix DEPM crash within inset.
authorAbdelrazak Younes <younes@lyx.org>
Thu, 30 Aug 2007 16:48:47 +0000 (16:48 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 30 Aug 2007 16:48:47 +0000 (16:48 +0000)
* BufferView::updateMetrics(): always clear the full text_metrics_ when doing a full update.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19919 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp

index c2dc15485e43b7ba0ac98d371f55a3ed3307260a..f3d3590c5d27de125b14d967801c3f97d636242b 100644 (file)
@@ -981,8 +981,6 @@ void BufferView::resize(int width, int height)
        width_ = width;
        height_ = height;
 
-       // The complete text metrics will be redone.
-       text_metrics_.clear();
        updateMetrics(false);
 }
 
@@ -1339,7 +1337,6 @@ ViewMetricsInfo const & BufferView::viewMetricsInfo()
 void BufferView::updateMetrics(bool singlepar)
 {
        Text & buftext = buffer_.text();
-       TextMetrics & tm = textMetrics(&buftext);
        pit_type size = int(buftext.paragraphs().size());
 
        if (anchor_ref_ > int(buftext.paragraphs().size() - 1)) {
@@ -1353,9 +1350,12 @@ void BufferView::updateMetrics(bool singlepar)
        
                // Clear out paragraph metrics to avoid having invalid metrics
                // in the cache from paragraphs not relayouted below
-               tm.clear();
+               // The complete text metrics will be redone.
+               text_metrics_.clear();
        }
 
+       TextMetrics & tm = textMetrics(&buftext);
+
        // If the paragraph metrics has changed, we can not
        // use the singlepar optimisation.
        if (singlepar