Skip to content

Commit

Permalink
Merge branch 'fix/double-deletion' into 'develop'
Browse files Browse the repository at this point in the history
fix double Deletion

See merge request VR-Group/unreal-development/plugins/universallogging!17
  • Loading branch information
Jonathan Ehret committed Jan 10, 2022
2 parents 74fe14c + 8d539ba commit d725792
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Source/UniversalLogging/Private/LogFileStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void LogFileStream::Open()
FString file_path = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + Filepath);
platform_file.CreateDirectoryTree(*file_path);
file_path = FPaths::Combine(file_path, Filename);
File_Handle = platform_file.OpenWrite(*file_path);
File_Handle.Reset(platform_file.OpenWrite(*file_path));
if (!File_Handle)
{
UE_LOG(LogUni, Error, TEXT("Universal Logging: The file %s could not be opened for writing."), *file_path);
Expand All @@ -35,8 +35,7 @@ void LogFileStream::Open()

void LogFileStream::Close()
{
delete File_Handle;
File_Handle = nullptr;
File_Handle.Reset();
bIs_Open = false;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/UniversalLogging/Private/LogFileStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class LogFileStream
const FString Filepath;
const FString Filename;
bool bIs_Open;
IFileHandle* File_Handle;
TUniquePtr <IFileHandle> File_Handle;
};

0 comments on commit d725792

Please sign in to comment.