https://bugs.kde.org/show_bug.cgi?id=338649
--- Comment #22 from Oliver Kellogg <okell...@users.sourceforge.net> ---
Git commit 7d3eb053739413a0eef8c111e0c9a41843227cf2 by Oliver Kellogg.
Committed on 09/05/2021 at 15:47.
Pushed by okellogg into branch 'release/21.04'.

Fix crash reported in https://bugs.kde.org/show_bug.cgi?id=338649#c20
related to multiple calls of m_source.unicode() where the calls return
different address values.
The solution is to call m_source.unicode() only once:

lib/cppparser/lexer.h
- In class Lexer add private member m_src of type const QChar*.

lib/cppparser/lexer.cpp
- In function Lexer::setSource,
  - assign m_source.unicode() to m_src;
  - if m_source.isEmpty() returns true then return without calling
    tokenize().
- In function Lexer::reset initialize m_src to null pointer.
- In function Lexer::offset return m_src + offset.
- In function Lexer::getOffset use m_src in lieu of src.
  This avoids the second call to m_source.unicode() which on newer Qt5
  versions may return a different buffer.

M  +8    -7    lib/cppparser/lexer.cpp
M  +1    -0    lib/cppparser/lexer.h

https://invent.kde.org/sdk/umbrello/commit/7d3eb053739413a0eef8c111e0c9a41843227cf2

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to