gbranden pushed a commit to branch master
in repository groff.

commit 12d114cf48ad52f386adb2dbd385f5cb07aecd0d
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jun 11 16:58:08 2026 -0500

    [refer]: Revise `input_item` constructor.
    
    * src/preproc/refer/command.cpp (input_item::input_item): Populate
      member variable `buffer` with copy initialization.  We shouldn't use
      `string::move()` because the string contents might not be
      heap-allocated in the first place.  Problem found the hard way with
      refactoring of groff's `string` class.
---
 ChangeLog                     | 8 ++++++++
 src/preproc/refer/command.cpp | 3 +--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 00ddd30ee..c880063dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-06-11  G. Branden Robinson <[email protected]>
+
+       * src/preproc/refer/command.cpp (input_item::input_item):
+       Populate member variable `buffer` with copy initialization.  We
+       shouldn't use `string::move()` because the string contents might
+       not be heap-allocated in the first place.  Problem found the
+       hard way with refactoring of groff's `string` class.
+
 2026-06-10  G. Branden Robinson <[email protected]>
 
        * src/preproc/refer/command.cpp (input_item::~input_item): The
diff --git a/src/preproc/refer/command.cpp b/src/preproc/refer/command.cpp
index a657ab53e..0d7f4b1c3 100644
--- a/src/preproc/refer/command.cpp
+++ b/src/preproc/refer/command.cpp
@@ -49,9 +49,8 @@ public:
 };
 
 input_item::input_item(string &s, const char *fn, int ln)
-: filename(strsave(fn)), first_lineno(ln)
+: filename(strsave(fn)), first_lineno(ln), buffer(s)
 {
-  buffer.move(s);
   ptr = buffer.contents();
   end = ptr + buffer.length();
 }

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to