Skip to content

Commit

Permalink
Kernel: Make Process::m_master_tls_region a WeakPtr
Browse files Browse the repository at this point in the history
Let's not keep raw Region* variables around like that when it's so easy
to avoid it.
  • Loading branch information
awesomekling committed Feb 28, 2020
1 parent b0623a0 commit 5af9513
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Kernel/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ pid_t Process::sys$fork(RegisterState& regs)
child_region.map(child->page_directory());

if (&region == m_master_tls_region)
child->m_master_tls_region = &child_region;
child->m_master_tls_region = child_region.make_weak_ptr();
}

child->m_extra_gids = m_extra_gids;
Expand Down Expand Up @@ -963,7 +963,7 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
m_unveiled_paths.clear();

// Copy of the master TLS region that we will clone for new threads
m_master_tls_region = master_tls_region;
m_master_tls_region = master_tls_region->make_weak_ptr();

auto main_program_metadata = main_program_description->metadata();

Expand Down
2 changes: 1 addition & 1 deletion Kernel/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ class Process : public InlineLinkedListNode<Process> {
RefPtr<ProcessTracer> m_tracer;
OwnPtr<ELFLoader> m_elf_loader;

Region* m_master_tls_region { nullptr };
WeakPtr<Region> m_master_tls_region;
size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 };

Expand Down

0 comments on commit 5af9513

Please sign in to comment.