[vte] parser: glue: StringTokeniser must not be used with a temporary



commit dff76fa217f8c6e1909e46e715416f01c0df397e
Author: Christian Persch <chpe src gnome org>
Date:   Sat Apr 14 23:49:27 2018 +0200

    parser: glue: StringTokeniser must not be used with a temporary
    
    StringTokeniser requires the string to be kept alive
    while iterating over its tokens.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=795269

 src/parser-glue.hh |    2 +-
 src/vteseq.cc      |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/parser-glue.hh b/src/parser-glue.hh
index 490b06c..db8b735 100644
--- a/src/parser-glue.hh
+++ b/src/parser-glue.hh
@@ -769,7 +769,7 @@ private:
         char_type m_separator{';'};
 
 public:
-        StringTokeniser(string_type const& s,
+        StringTokeniser(string_type& s,
                         char_type separator = ';')
                 : m_string{s},
                   m_separator{separator}
diff --git a/src/vteseq.cc b/src/vteseq.cc
index cec74fa..ba97480 100644
--- a/src/vteseq.cc
+++ b/src/vteseq.cc
@@ -1549,7 +1549,8 @@ VteTerminalPrivate::set_current_hyperlink(vte::parser::Sequence const& seq,
         std::string hyperlink;
 
         /* First, find the ID */
-        vte::parser::StringTokeniser subtokeniser{*token, ':'};
+        auto tokenstr = *token;
+        vte::parser::StringTokeniser subtokeniser{tokenstr, ':'};
         for (auto subtoken : subtokeniser) {
                 auto const len = subtoken.size();
                 if (len < 3)
@@ -6255,7 +6256,7 @@ VteTerminalPrivate::OSC(vte::parser::Sequence const& seq)
          * First, extract the number.
          */
 
-        auto const str = seq.string_utf8();
+        auto str = seq.string_utf8();
         vte::parser::StringTokeniser tokeniser{str, ';'};
         auto it = tokeniser.cbegin();
         int osc;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]