Abdelrazak Younes wrote:
Jürgen Spitzmüller wrote:
Abdelrazak Younes wrote:
http://www.lyx.org/trac/changeset/19919 - Fix DEPM crash within inset.
always clear the full text_metrics_ when doing a full update.
Applicable to branch?
In theory yes but this will have side effects within insets.

What kind of side effects?

I am not sure... maybe crashes, maybe cleared out text... In trunk, the only side effect (besides fixing the DEPM crash) was that I had to force full repaint in tabular cells. But a full repaint occurred anyway so no harm done. I'll tell you what, I'll produce a patch and let you test it and decide if it is safe or not.

Well, I verified that there is no apparent side effect and I cannot see how it could have anyway so I just committed it. The patch is short so it can be reverted easily in case of problems but I really don't expect any. I didn't put an entry in status.15x because I don't know what to put...

Abdel.

Author: younes
Date: Tue Sep 11 22:09:36 2007
New Revision: 20220

URL: http://www.lyx.org/trac/changeset/20220
Log:
BufferView: Be on the safe side: clear out all of text_metrics_ when doing a full update.

Modified:
    lyx-devel/branches/BRANCH_1_5_X/src/BufferView.cpp

Modified: lyx-devel/branches/BRANCH_1_5_X/src/BufferView.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/branches/BRANCH_1_5_X/src/BufferView.cpp?rev=20220
==============================================================================
--- lyx-devel/branches/BRANCH_1_5_X/src/BufferView.cpp (original)
+++ lyx-devel/branches/BRANCH_1_5_X/src/BufferView.cpp Tue Sep 11 22:09:36 2007
@@ -1097,9 +1097,6 @@
        width_ = width;
        height_ = height;

-       // The complete text metrics will be redone.
-       text_metrics_.clear();
-
        if (buffer_)
                resize();
 }
@@ -1464,7 +1461,6 @@
 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)) {
@@ -1478,8 +1474,11 @@
        
                // 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.




Reply via email to