mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibCore: Remove unnecessary lifetime extension from ProcessSpawnOptions
We don't need `file_actions` to be a constant-reference. It's created in-place by its one user (HackStudio). Because it is currently a const- ref, if we try to create a ProcessSpawnOptions like so: Core::ProcessSpawnOptions options { .name = "foo"sv }; We get the following error with clang 18: lifetime extension of temporary created by aggregate initialization using a default member initializer is not yet supported; lifetime of temporary will end at the end of the full-expression
This commit is contained in:
parent
2bba9411ca
commit
207f3f1cb4
Notes:
sideshowbarker
2024-07-16 22:17:03 +09:00
Author: https://github.com/trflynn89
Commit: 207f3f1cb4
Pull-request: https://github.com/SerenityOS/serenity/pull/24133
Issue: https://github.com/SerenityOS/serenity/issues/24130
2 changed files with 2 additions and 2 deletions
|
@ -364,7 +364,7 @@ ErrorOr<IPCProcess::ProcessAndIPCSocket> IPCProcess::spawn_and_connect_to_proces
|
||||||
ArmedScopeGuard guard_fd_0 { [&] { MUST(System::close(socket_fds[0])); } };
|
ArmedScopeGuard guard_fd_0 { [&] { MUST(System::close(socket_fds[0])); } };
|
||||||
ArmedScopeGuard guard_fd_1 { [&] { MUST(System::close(socket_fds[1])); } };
|
ArmedScopeGuard guard_fd_1 { [&] { MUST(System::close(socket_fds[1])); } };
|
||||||
|
|
||||||
auto& file_actions = const_cast<Vector<ProcessSpawnOptions::FileActionType>&>(options.file_actions);
|
auto& file_actions = const_cast<ProcessSpawnOptions&>(options).file_actions;
|
||||||
file_actions.append(FileAction::CloseFile { socket_fds[0] });
|
file_actions.append(FileAction::CloseFile { socket_fds[0] });
|
||||||
|
|
||||||
auto takeover_string = MUST(String::formatted("{}:{}", options.name, socket_fds[1]));
|
auto takeover_string = MUST(String::formatted("{}:{}", options.name, socket_fds[1]));
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct ProcessSpawnOptions {
|
||||||
Optional<ByteString> working_directory {};
|
Optional<ByteString> working_directory {};
|
||||||
|
|
||||||
using FileActionType = Variant<FileAction::OpenFile, FileAction::CloseFile>;
|
using FileActionType = Variant<FileAction::OpenFile, FileAction::CloseFile>;
|
||||||
Vector<FileActionType> const& file_actions {};
|
Vector<FileActionType> file_actions {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class IPCProcess;
|
class IPCProcess;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue