Skip to content
Commit 7d3eb053 authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

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.

CCBUG: 338649
parent 4cea2f59
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment