]> git.lyx.org Git - lyx.git/commitdiff
At metrics time, store paragraph id too
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 22 Feb 2023 17:09:03 +0000 (18:09 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 3 Mar 2023 09:34:18 +0000 (10:34 +0100)
Instead of actually fixing the messiness of InsetInfo, let's just fix
the symptom and avoid the access to Paragraph::id() that was crashing
LyX every time updateBuffer/validate/metrics/draw did not happen in
the right order.

Fixes bug #12639.

src/ParagraphMetrics.cpp
src/ParagraphMetrics.h
src/TextMetrics.cpp

index 46f2edc9aa689851436efba5a758a1a3057c9dc0..31b31a2d0158a156117835fb3af784369c398acd 100644 (file)
@@ -42,7 +42,7 @@ namespace lyx {
 
 
 ParagraphMetrics::ParagraphMetrics(Paragraph const & par) :
-       position_(-1), par_(&par)
+       position_(-1), id_(par.id()), par_(&par)
 {}
 
 
index 1d690aab7732071944792d67951a81cece524802..e0d9ce054144893b64477ef1b88db42778050811 100644 (file)
@@ -72,11 +72,15 @@ public:
        ///
        int position() const { return position_; }
        void setPosition(int position);
+       ///
+       int id() const { return id_; }
 
 private:
        ///
        int position_;
        ///
+       int id_;
+       ///
        mutable RowList rows_;
        /// cached dimensions of paragraph
        Dimension dim_;
index 2dea92bbff3befd3102eb48a02b61572710830c8..995b09ce07f598ed69c33da8ef1cc0e53931a50d 100644 (file)
@@ -1986,7 +1986,7 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type const pit, int const
                swap(pi.leftx, pi.rightx);
 
        BookmarksSection::BookmarkPosList bpl =
-               theSession().bookmarks().bookmarksInPar(bv_->buffer().fileName(), pm.par().id());
+               theSession().bookmarks().bookmarksInPar(bv_->buffer().fileName(), pm.id());
 
        for (size_t i = 0; i != nrows; ++i) {