Commit 26cfe244 authored by Marco Bubke's avatar Marco Bubke
Browse files

Clang: Reset pointer to null in unsaved files



Change-Id: I85243b6b041e639fb6313e2fb794a658ca456ea3
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent ec4d0028
......@@ -53,7 +53,7 @@ UnsavedFilesData::UnsavedFilesData()
UnsavedFilesData::~UnsavedFilesData()
{
for (const CXUnsavedFile &cxUnsavedFile : cxUnsavedFiles)
for (CXUnsavedFile &cxUnsavedFile : cxUnsavedFiles)
UnsavedFiles::deleteCXUnsavedFile(cxUnsavedFile);
cxUnsavedFiles.clear();
......@@ -99,7 +99,7 @@ void UnsavedFiles::remove(const QVector<FileContainer> &fileContainers)
void UnsavedFiles::clear()
{
for (const CXUnsavedFile &cxUnsavedFile : d->cxUnsavedFiles)
for (CXUnsavedFile &cxUnsavedFile : d->cxUnsavedFiles)
deleteCXUnsavedFile(cxUnsavedFile);
d->cxUnsavedFiles.clear();
......@@ -137,10 +137,13 @@ CXUnsavedFile UnsavedFiles::createCxUnsavedFile(const Utf8String &filePath, cons
return CXUnsavedFile { cxUnsavedFilePath, cxUnsavedFileContent, ulong(fileContent.byteSize())};
}
void UnsavedFiles::deleteCXUnsavedFile(const CXUnsavedFile &cxUnsavedFile)
void UnsavedFiles::deleteCXUnsavedFile(CXUnsavedFile &cxUnsavedFile)
{
delete [] cxUnsavedFile.Contents;
delete [] cxUnsavedFile.Filename;
cxUnsavedFile.Contents = nullptr;
cxUnsavedFile.Filename = nullptr;
cxUnsavedFile.Length = 0;
}
void UnsavedFiles::updateCXUnsavedFileWithFileContainer(const FileContainer &fileContainer)
......
......@@ -73,7 +73,7 @@ public:
private:
CXUnsavedFile createCxUnsavedFile(const Utf8String &filePath, const Utf8String &fileContent);
static void deleteCXUnsavedFile(const CXUnsavedFile &cxUnsavedFile);
static void deleteCXUnsavedFile(CXUnsavedFile &cxUnsavedFile);
void updateCXUnsavedFileWithFileContainer(const FileContainer &fileContainer);
void removeCXUnsavedFile(const FileContainer &fileContainer);
void addOrUpdateCXUnsavedFile(const FileContainer &fileContainer);
......
Markdown is supported
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