Skip to content
Snippets Groups Projects
Commit d7257923 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

Merge branch 'fix/double-deletion' into 'develop'

fix double Deletion

See merge request VR-Group/unreal-development/plugins/universallogging!17
parents 74fe14cd 8d539baa
No related branches found
No related tags found
2 merge requests!17fix double Deletion,!16Develop
...@@ -23,7 +23,7 @@ void LogFileStream::Open() ...@@ -23,7 +23,7 @@ void LogFileStream::Open()
FString file_path = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + Filepath); FString file_path = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir() + Filepath);
platform_file.CreateDirectoryTree(*file_path); platform_file.CreateDirectoryTree(*file_path);
file_path = FPaths::Combine(file_path, Filename); 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) if (!File_Handle)
{ {
UE_LOG(LogUni, Error, TEXT("Universal Logging: The file %s could not be opened for writing."), *file_path); UE_LOG(LogUni, Error, TEXT("Universal Logging: The file %s could not be opened for writing."), *file_path);
...@@ -35,8 +35,7 @@ void LogFileStream::Open() ...@@ -35,8 +35,7 @@ void LogFileStream::Open()
void LogFileStream::Close() void LogFileStream::Close()
{ {
delete File_Handle; File_Handle.Reset();
File_Handle = nullptr;
bIs_Open = false; bIs_Open = false;
} }
......
...@@ -15,5 +15,5 @@ private: ...@@ -15,5 +15,5 @@ private:
const FString Filepath; const FString Filepath;
const FString Filename; const FString Filename;
bool bIs_Open; bool bIs_Open;
IFileHandle* File_Handle; TUniquePtr <IFileHandle> File_Handle;
}; };
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment