mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
This commit is contained in:
committed by
Andreas Kling
parent
9b8f35259c
commit
fc6d051dfd
@@ -426,7 +426,7 @@ String Emulator::create_backtrace_line(FlatPtr address)
|
||||
|
||||
auto source_position = it->value.debug_info->get_source_position(address - region->base());
|
||||
if (source_position.has_value())
|
||||
return String::formatted("=={{{}}}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), (void*)address, lib_name, symbol, LexicalPath(source_position.value().file_path).basename(), source_position.value().line_number);
|
||||
return String::formatted("=={{{}}}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), (void*)address, lib_name, symbol, LexicalPath::basename(source_position.value().file_path), source_position.value().line_number);
|
||||
|
||||
return line_without_source_info;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ String Emulator::create_instruction_line(FlatPtr address, X86::Instruction insn)
|
||||
if (!source_position.has_value())
|
||||
return minimal;
|
||||
|
||||
return String::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", (void*)address, insn.to_string(address), LexicalPath(source_position.value().file_path).basename(), source_position.value().line_number);
|
||||
return String::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", (void*)address, insn.to_string(address), LexicalPath::basename(source_position.value().file_path), source_position.value().line_number);
|
||||
}
|
||||
|
||||
static void emulator_signal_handler(int signum)
|
||||
|
||||
Reference in New Issue
Block a user