mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
Kernel: Make Process::current() return a Process& instead of Process*
This has several benefits: 1) We no longer just blindly derefence a null pointer in various places 2) We will get nicer runtime error messages if the current process does turn out to be null in the call location 3) GCC no longer complains about possible nullptr dereferences when compiling without KUBSAN
This commit is contained in:
committed by
Andreas Kling
parent
1259dc3623
commit
cf271183b4
@@ -389,7 +389,7 @@ void create_signal_trampoline()
|
||||
void Process::crash(int signal, FlatPtr ip, bool out_of_memory)
|
||||
{
|
||||
VERIFY(!is_dead());
|
||||
VERIFY(Process::current() == this);
|
||||
VERIFY(&Process::current() == this);
|
||||
|
||||
if (out_of_memory) {
|
||||
dbgln("\033[31;1mOut of memory\033[m, killing: {}", *this);
|
||||
@@ -720,7 +720,7 @@ void Process::terminate_due_to_signal(u8 signal)
|
||||
{
|
||||
VERIFY_INTERRUPTS_DISABLED();
|
||||
VERIFY(signal < 32);
|
||||
VERIFY(Process::current() == this);
|
||||
VERIFY(&Process::current() == this);
|
||||
dbgln("Terminating {} due to signal {}", *this, signal);
|
||||
{
|
||||
ProtectedDataMutationScope scope { *this };
|
||||
|
||||
Reference in New Issue
Block a user