commit 6831c3f68672bc13647fa7ec768c13b75d4ff5a5
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date:   Mon Feb 17 00:17:50 2025 +0100

    Initialize properly TextMetrics::im_ (spotted by Coversity Scan)
---
 src/TextMetrics.cpp |  2 +-
 src/TextMetrics.h   | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 36053dd819..757dfd1e5c 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -108,7 +108,7 @@ int numberOfHfills(Row const & row, ParagraphMetrics const 
& pm,
 
 TextMetrics::TextMetrics(BufferView * bv, Text * text)
     : bv_(bv), text_(text), im_(bv_->inputMethod()),
-      dim_(bv_->workWidth(), 10, 10), max_width_(dim_.wid), tight_(false)
+      dim_(bv_->workWidth(), 10, 10), max_width_(dim_.wid)
 {}
 
 
diff --git a/src/TextMetrics.h b/src/TextMetrics.h
index 0d86260505..e7b03939c4 100644
--- a/src/TextMetrics.h
+++ b/src/TextMetrics.h
@@ -40,7 +40,7 @@ class TextMetrics
        void operator=(TextMetrics const &);
 public:
        /// Default constructor (only here for STL containers).
-       TextMetrics() : bv_(0), text_(0), max_width_(0), tight_(false) {}
+       TextMetrics() {}
        /// The only useful constructor.
        TextMetrics(BufferView *, Text *);
 
@@ -244,23 +244,23 @@ public:
 private:
 
        /// The BufferView owner.
-       BufferView * bv_;
+       BufferView * bv_ = nullptr;
 
        /// The text contents (the model).
        /// \todo FIXME: this should be const.
-       Text * text_;
+       Text * text_ = nullptr;
 
        /// The input method instance
-       frontend::InputMethod * im_;
+       frontend::InputMethod * im_ = nullptr;
 
        /// A map from paragraph index number to paragraph metrics
        typedef std::map<pit_type, ParagraphMetrics> ParMetricsCache;
        ///
        mutable ParMetricsCache par_metrics_;
        Dimension dim_;
-       int max_width_;
+       int max_width_ = 0;
        /// if true, do not expand insets to max width artificially
-       bool tight_;
+       bool tight_ = false;
        mutable Point origin_;
 
 // temporary public:
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to