[sdk/kdiff3/1.13] src: Intialize m_pBuf with an empty buffer.
Michael Reeves <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e5e5826a91394a65643a23aeb65527bb2372375b by Michael Reeves.
Committed on 21/07/2026 at 21:23.
Pushed by mreeves into branch '1.13'.
Intialize m_pBuf with an empty buffer.
BUG: 523325
FIXED-IN:1.12.6
M +0 -1 src/SourceData.cpp
M +1 -1 src/SourceData.h
https://invent.kde.org/sdk/kdiff3/-/commit/e5e5826a91394a65643a23aeb65527bb2372375b
diff --git a/src/SourceData.cpp b/src/SourceData.cpp
index b98a7e81..c48cdbef 100644
--- a/src/SourceData.cpp
+++ b/src/SourceData.cpp
@@ -175,7 +175,6 @@ const std::shared_ptr<LineDataVector>& SourceData::getLineDataForDisplay() const
LineType SourceData::lineCount() const
{
- assert(m_normalData.m_pBuf != nullptr);
return SafeInt<LineType>(m_normalData.lineCount());
}
diff --git a/src/SourceData.h b/src/SourceData.h
index 67964e9c..1082c462 100644
--- a/src/SourceData.h
+++ b/src/SourceData.h
@@ -88,7 +88,7 @@ class SourceData
friend SourceData;
bool mHasBOM = false;
- std::unique_ptr<char[]> m_pBuf; //TODO: Phase out needlessly wastes memory and time by keeping second copy of file data.
+ std::unique_ptr<char[]> m_pBuf = std::make_unique<char[]>(0); // TODO: Phase out needlessly wastes memory and time by keeping second copy of file data.
quint64 mDataSize = 0;
qint64 mLineCount = 0; // Number of lines in m_pBuf1 and size of m_v1, m_dv12 and m_dv13
std::shared_ptr<QString> m_unicodeBuf = std::make_shared<QString>();