commit 7d778ca0fb137b36c5cfbdf86f326ebc35b2516e
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Wed Jun 11 23:26:41 2025 +0200

    Add new Bullet constructor
    
    The default one cannot be relied on because Bullet::operator= is defined.
    
    Bascally, the only reason why this is needed is the presence of calls
    to testInvariant. It may be relevant to evaluate the usefulness of
    these assertions.
    
    Avoids the following gcc warning:
    
    ../../master/src/BufferParams.cpp:340:21: warning: implicitly-declared 
‘lyx::Bullet::Bullet(const lyx::Bullet&)’ is deprecated [-Wdeprecated-copy]
      340 | class BufferParams::Impl
          |                     ^~~~
    In file included from ../../master/src/BufferParams.cpp:24:
    ../../master/src/Bullet.h:53:18: note: because ‘lyx::Bullet’ has 
user-provided ‘lyx::Bullet& lyx::Bullet::operator=(const lyx::Bullet&)’
       53 |         Bullet & operator=(Bullet const &);
          |                  ^~~~~~~~
---
 src/Bullet.cpp | 37 +++++++++++++++++++++++--------------
 src/Bullet.h   |  2 ++
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/src/Bullet.cpp b/src/Bullet.cpp
index 4308189d92..e4a2c616b5 100644
--- a/src/Bullet.cpp
+++ b/src/Bullet.cpp
@@ -38,6 +38,15 @@ Bullet const ITEMIZE_DEFAULTS[4] = { Bullet(0, 
8),//"\\(\\bullet\\)"
 // and wasysym when that panel is created
 
 
+Bullet::Bullet(Bullet const & b)
+       : font(b.font), character(b.character), size(b.size), 
user_text(b.user_text),
+         text(b.text), label(b.label)
+{
+       b.testInvariant();
+       this->testInvariant();
+}
+
+
 Bullet::Bullet(int f, int c, int s)
        : font(f), character(c), size(s), user_text(0)
 {
@@ -60,6 +69,20 @@ Bullet::Bullet(docstring const & t)
 }
 
 
+Bullet & Bullet::operator=(Bullet const & b)
+{
+       b.testInvariant();
+       font = b.font;
+       character = b.character;
+       size = b.size;
+       user_text = b.user_text;
+       text = b.text;
+       label = b.label;
+       this->testInvariant();
+       return *this;
+}
+
+
 void Bullet::setCharacter(int c)
 {
        if (c < MIN || c >= CHARMAX)
@@ -130,20 +153,6 @@ FontSize Bullet::getFontSize() const
 }
 
 
-Bullet & Bullet::operator=(Bullet const & b)
-{
-       b.testInvariant();
-       font = b.font;
-       character = b.character;
-       size = b.size;
-       user_text = b.user_text;
-       text = b.text;
-       label = b.label;
-       this->testInvariant();
-       return *this;
-}
-
-
 docstring const & Bullet::getText() const
 {
        if (user_text == 0)
diff --git a/src/Bullet.h b/src/Bullet.h
index 662fa224d7..c60ab69cec 100644
--- a/src/Bullet.h
+++ b/src/Bullet.h
@@ -23,6 +23,8 @@ namespace lyx {
 ///
 class Bullet {
 public:
+       ///
+       Bullet(Bullet const & b);
        ///
        Bullet(int f = -1, int c = -1, int s = -1);
 
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to