diff options
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp index abe179e96e..9928632273 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryViewWidget.cpp @@ -311,7 +311,12 @@ constexpr int GetCharacterCount(MemoryViewWidget::Type type) void MemoryViewWidget::UpdateDispatcher(UpdateType type) { - if (!isVisible()) + std::unique_lock lock(m_updating, std::defer_lock); + + // A full update may change parameters like row count, so make sure it goes through. + if (type == UpdateType::Full) + lock.lock(); + else if (!isVisible() || !lock.try_lock()) return; // Check if table needs to be created. @@ -331,6 +336,10 @@ void MemoryViewWidget::UpdateDispatcher(UpdateType type) GetValues(); UpdateColumns(); break; + case UpdateType::Auto: + // Values were captured on CPU thread while doing a callback. + if (m_values.size() != 0) + UpdateColumns(); default: break; } @@ -522,6 +531,18 @@ void MemoryViewWidget::UpdateColumns() } } +// Always runs on CPU thread from a callback. +void MemoryViewWidget::UpdateOnFrameEnd() +{ + std::unique_lock lock(m_updating, std::try_to_lock); + if (lock) + { + GetValues(); + // Should not directly trigger widget updates on a cpu thread. Signal main thread to do it. + emit AutoUpdate(); + } +} + void MemoryViewWidget::GetValues() { m_values.clear(); |
