Explorar el Código

yuzu/debugger/wait_tree: Remove use of global CurrentProcess accessor

We already have the thread instance that was created under the current
process, so we can just pass the handle table of it along to retrieve
the owner of the mutex.
Lioncash hace 7 años
padre
commit
196cc82913
Se han modificado 2 ficheros con 6 adiciones y 5 borrados
  1. 4 4
      src/yuzu/debugger/wait_tree.cpp
  2. 2 1
      src/yuzu/debugger/wait_tree.h

+ 4 - 4
src/yuzu/debugger/wait_tree.cpp

@@ -81,9 +81,8 @@ QString WaitTreeText::GetText() const {
     return text;
 }
 
-WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address) : mutex_address(mutex_address) {
-    const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
-
+WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address, const Kernel::HandleTable& handle_table)
+    : mutex_address(mutex_address) {
     mutex_value = Memory::Read32(mutex_address);
     owner_handle = static_cast<Kernel::Handle>(mutex_value & Kernel::Mutex::MutexOwnerMask);
     owner = handle_table.Get<Kernel::Thread>(owner_handle);
@@ -316,7 +315,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
 
     const VAddr mutex_wait_address = thread.GetMutexWaitAddress();
     if (mutex_wait_address != 0) {
-        list.push_back(std::make_unique<WaitTreeMutexInfo>(mutex_wait_address));
+        const auto& handle_table = thread.GetOwnerProcess()->GetHandleTable();
+        list.push_back(std::make_unique<WaitTreeMutexInfo>(mutex_wait_address, handle_table));
     } else {
         list.push_back(std::make_unique<WaitTreeText>(tr("not waiting for mutex")));
     }

+ 2 - 1
src/yuzu/debugger/wait_tree.h

@@ -17,6 +17,7 @@
 class EmuThread;
 
 namespace Kernel {
+class HandleTable;
 class ReadableEvent;
 class WaitObject;
 class Thread;
@@ -72,7 +73,7 @@ public:
 class WaitTreeMutexInfo : public WaitTreeExpandableItem {
     Q_OBJECT
 public:
-    explicit WaitTreeMutexInfo(VAddr mutex_address);
+    explicit WaitTreeMutexInfo(VAddr mutex_address, const Kernel::HandleTable& handle_table);
     ~WaitTreeMutexInfo() override;
 
     QString GetText() const override;