diff options
author | hjk <hjk@qt.io> | 2020-06-17 11:13:59 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-06-17 12:42:48 +0000 |
commit | 14d83e027bad10dbe7363220043a5d0a622cbc4a (patch) | |
tree | a31194abbf9a7bcacb36389956fc8dde82433ae7 | |
parent | c9355626d57d27c9c271c939f0d345fa41a488a7 (diff) |
BinEditor: Crash less on search
Task-number: QTCREATORBUG-21473
Task-number: QTCREATORBUG-23978
Change-Id: I8f63fa892b9ef37bc660bd0b96fce5e1d6772b57
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
-rw-r--r-- | src/plugins/bineditor/bineditorwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index ab8f6d0ba4..2c703512d1 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -613,7 +613,6 @@ int BinEditorWidget::dataIndexOf(const QByteArray &pattern, qint64 from, bool ca QByteArray buffer; buffer.resize(m_blockSize + trailing); - char *b = buffer.data(); QByteArrayMatcher matcher(pattern); qint64 block = from / m_blockSize; @@ -622,6 +621,7 @@ int BinEditorWidget::dataIndexOf(const QByteArray &pattern, qint64 from, bool ca if (!requestDataAt(block * m_blockSize)) return -1; QByteArray data = blockData(block); + char *b = buffer.data(); ::memcpy(b, b + m_blockSize, trailing); ::memcpy(b + trailing, data.constData(), m_blockSize); @@ -645,7 +645,6 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo QByteArray buffer; buffer.resize(m_blockSize + trailing); - char *b = buffer.data(); if (from == -1) from = m_size; @@ -655,6 +654,7 @@ int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, qint64 from, boo if (!requestDataAt(qint64(block) * m_blockSize)) return -1; QByteArray data = blockData(block); + char *b = buffer.data(); ::memcpy(b + m_blockSize, b, trailing); ::memcpy(b, data.constData(), m_blockSize); |