core: Switch to unique_ptr for usage of Common::Fiber.
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context. - Fixes a memory leak due to circular reference of the shared pointer.
This commit is contained in:
parent
09f7c355c6
commit
51fb0a6f96
10 changed files with 58 additions and 59 deletions
|
@ -293,7 +293,13 @@ public:
|
|||
return thread_context_64;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::shared_ptr<Common::Fiber>& GetHostContext();
|
||||
[[nodiscard]] Common::Fiber* GetHostContext() {
|
||||
return host_context.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] const Common::Fiber* GetHostContext() const {
|
||||
return host_context.get();
|
||||
}
|
||||
|
||||
[[nodiscard]] ThreadState GetState() const {
|
||||
return thread_state & ThreadState::Mask;
|
||||
|
@ -719,7 +725,7 @@ private:
|
|||
Common::SpinLock context_guard{};
|
||||
|
||||
// For emulation
|
||||
std::shared_ptr<Common::Fiber> host_context{};
|
||||
std::unique_ptr<Common::Fiber> host_context{};
|
||||
|
||||
// For debugging
|
||||
std::vector<KSynchronizationObject*> wait_objects_for_debugging;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue