[sdk/kdiff3/1.12.6] src: Intialize m_pBuf with an empty buffer.
Michael Reeves <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 39a94dea9e30f3adc40d9de4bf4daa50de73fc3f by Michael Reeves.
Committed on 21/07/2026 at 21:25.
Pushed by mreeves into tag '1.12.6'.
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/39a94dea9e30f3adc40d9de4bf4daa50de73fc3f
diff --git a/src/SourceData.cpp b/src/SourceData.cpp
index b9baa494..0b6e1713 100644
--- a/src/SourceData.cpp
+++ b/src/SourceData.cpp
@@ -176,7 +176,6 @@ const std::shared_ptr<LineDataVector>& SourceData::getLineDataForDisplay() const
LineType SourceData::getSizeLines() const
{
- assert(m_normalData.m_pBuf != nullptr);
return SafeInt<LineType>(m_normalData.lineCount());
}
diff --git a/src/SourceData.h b/src/SourceData.h
index 6fe4ace2..a0b49d5c 100644
--- a/src/SourceData.h
+++ b/src/SourceData.h
@@ -89,7 +89,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
QSharedPointer<QString> m_unicodeBuf=QSharedPointer<QString>::create();