PixelPaint: Fix broken opening of files from Shell

The fd would get closed when the File went out of scope, so we couldn't
open any file specified by 'pp <path to file>'. We need the fd to be
alive and we solemnly swear to take good care of it and close it
ourselves later.
This commit is contained in:
Tobias Christiansen 2021-09-04 14:13:52 +02:00 committed by Andreas Kling
parent 9699648b2a
commit 5d732711a2

View file

@ -69,7 +69,7 @@ Result<void, String> ProjectLoader::try_load_from_path(StringView path)
if (file_or_error.is_error())
return String::formatted("Unable to open file because: {}", file_or_error.release_error());
return try_load_from_fd_and_close(file_or_error.release_value()->fd(), path);
return try_load_from_fd_and_close(file_or_error.release_value()->leak_fd(), path);
}
}