From 5d732711a210584d5e0c63b7a99b5a9d8b17aede Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Sat, 4 Sep 2021 14:13:52 +0200 Subject: [PATCH] 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 '. We need the fd to be alive and we solemnly swear to take good care of it and close it ourselves later. --- Userland/Applications/PixelPaint/ProjectLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Applications/PixelPaint/ProjectLoader.cpp b/Userland/Applications/PixelPaint/ProjectLoader.cpp index 0dfab4bdbf..66303827ac 100644 --- a/Userland/Applications/PixelPaint/ProjectLoader.cpp +++ b/Userland/Applications/PixelPaint/ProjectLoader.cpp @@ -69,7 +69,7 @@ Result 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); } }