Edwin Leuven wrote:
guys,

i am (still) fiddling with the tabular code.

after a cell merge there is a redraw which then *sometimes* crashes lyx.

the strange thing is that sometimes it happens, sometimes it doesn't!

backtrace below.

i haven't been able to find out what causes it, and am really at a loss.

so if someone has a hunch that would be great cause i am kinda stuck here...

I think I've fixed this problem. The ParagraphMetrics was not updated with the new Paragraph address upon Paragraph insertion/deletion.

Please try again.

Author: younes
Date: Mon Aug 27 16:04:46 2007
New Revision: 19833

URL: http://www.lyx.org/trac/changeset/19833
Log:
Gather ParagraphMetrics initialization in ParagraphMetrics::reset().

Modified:
    lyx-devel/trunk/src/ParagraphMetrics.cpp
    lyx-devel/trunk/src/ParagraphMetrics.h
    lyx-devel/trunk/src/TextMetrics.cpp

Modified: lyx-devel/trunk/src/ParagraphMetrics.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/ParagraphMetrics.cpp?rev=19833
==============================================================================
--- lyx-devel/trunk/src/ParagraphMetrics.cpp (original)
+++ lyx-devel/trunk/src/ParagraphMetrics.cpp Mon Aug 27 16:04:46 2007
@@ -88,6 +88,14 @@
 }


+void ParagraphMetrics::reset(Paragraph const & par)
+{
+       par_ = ∥
+       dim_ = Dimension();
+       rows_.clear();
+}
+
+
 size_type ParagraphMetrics::calculateRowSignature(Row const & row)
 {
        boost::crc_32_type crc;

Modified: lyx-devel/trunk/src/ParagraphMetrics.h
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/ParagraphMetrics.h?rev=19833
==============================================================================
--- lyx-devel/trunk/src/ParagraphMetrics.h (original)
+++ lyx-devel/trunk/src/ParagraphMetrics.h Mon Aug 27 16:04:46 2007
@@ -44,6 +44,8 @@
        /// \c row_signature_ because those are updated externally with
        /// \c updateRowChangeStatus() in TextMetrics::redoParagraph().
        ParagraphMetrics & operator=(ParagraphMetrics const &);
+
+       void reset(Paragraph const & par);

        ///
        Row & getRow(pos_type pos, bool boundary);

Modified: lyx-devel/trunk/src/TextMetrics.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/TextMetrics.cpp?rev=19833
==============================================================================
--- lyx-devel/trunk/src/TextMetrics.cpp (original)
+++ lyx-devel/trunk/src/TextMetrics.cpp Mon Aug 27 16:04:46 2007
@@ -184,13 +184,13 @@

 bool TextMetrics::redoParagraph(pit_type const pit)
 {
+       Paragraph & par = text_->getPar(pit);
        // IMPORTANT NOTE: We pass 'false' explicitely in order to not call
        // redoParagraph() recursively inside parMetrics.
        Dimension old_dim = parMetrics(pit, false).dim();
        ParagraphMetrics & pm = par_metrics_[pit];
-       // reinitialize paragraph dimension.
-       pm.dim() = Dimension();
-       Paragraph & par = text_->getPar(pit);
+       pm.reset(par);
+
        Buffer & buffer = bv_->buffer();
        main_text_ = (text_ == &buffer.text());
        bool changed = false;
@@ -229,9 +229,6 @@
                MetricsInfo mi(bv_, font, w);
                changed |= ii->inset->metrics(mi, dim);
        }
-
-       // rebreak the paragraph
-       pm.rows().clear();

        par.setBeginOfBody();
        pos_type z = 0;




Reply via email to