Skip to content
Commit 3041141b authored by Oliver Kellogg's avatar Oliver Kellogg
Browse files

lib/cppparser/lexer.{h,cpp} followup to commit 7d3eb053,

> Fix crash [...] 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: [...]

As detailed by jeremy_k at https://forum.qt.io/post/659243,
the above change does not remove the root cause:
- m_ptr is initially set to m_source.unicode()
- During the import, m_source is modified (e.g. by calls to function
  insertCurrent).
- These modifications invalidate the unicode buffer which is pointed to
  by m_ptr / m_endPtr.
Generally I do not see a significant advantage in using the unicode
buffer in this context.

Changes in class Lexer:
- Remove public functions
  - const CHARTYPE* offset(int offset) const;
  - int getOffset(const QChar* p) const.
- Remove private function
  void setEndPtr(const QChar* c).
- Remove private members m_src, m_ptr, m_endPtr of type `const QChar*`.
- Add private members m_idx, m_endIdx of type int.
  These are used as indexes into m_source.

CCBUG: 338649
parent 7d3eb053
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