commit 13b05603d21a05cf70f4327b61ed6a65cac2bffb
Author: Koji Yokota <[email protected]>
Date:   Tue Jun 30 19:09:41 2026 +0900

    Fix ticket #13345: bad use of iterators
---
 src/frontends/qt/GuiInputMethod.cpp | 5 ++++-
 src/frontends/qt/GuiInputMethod.h   | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index 9f1d050967..86b1424202 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -736,7 +736,10 @@ pos_type GuiInputMethod::pickNextSegFromTurnout(pos_type 
next_seg_pos, size_type
                                LYXERR(Debug::KEY, "Removing from preedit 
turnout: ["
                                        << it->start_ << ", "
                                        << it->start_ + it->length_ << ")");
-                               d->seg_turnout_.erase(it);
+                               for (auto it2 = d->seg_turnout_.begin();
+                                    it2 != d->seg_turnout_.end(); it2++)
+                                       if (*it == *it2)
+                                               d->seg_turnout_.erase(it2);
                        }
                }
        }
diff --git a/src/frontends/qt/GuiInputMethod.h 
b/src/frontends/qt/GuiInputMethod.h
index 9945b7f4b5..36b129f63f 100644
--- a/src/frontends/qt/GuiInputMethod.h
+++ b/src/frontends/qt/GuiInputMethod.h
@@ -45,6 +45,13 @@ public:
                bool operator<(const PreeditSegment & another) const {
                        return start_ < another.start_;
                }
+               bool operator>(const PreeditSegment & another) const {
+                       return start_ > another.start_;
+               }
+               bool operator==(const PreeditSegment & another) const {
+                       return start_ == another.start_ && length_ == 
another.length_ &&
+                               char_format_ == another.char_format_;
+               }
        };
 
        struct PreeditStyle {
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to