mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Fix lock around vkey queue in EmuScreen
This commit is contained in:
1 parent
46b986ec79
commit
9fc2fff68a
2 files changed
+10
-2
No files matched your search
+9
-2
@@ -733,14 +733,21 @@ static void ShowFpsLimitNotice() {
|
||||
void EmuScreen::OnVKey(VirtKey virtualKeyCode, bool down) {
|
||||
if (!IsOnTop())
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(queuedVirtKeysLock_);
|
||||
queuedVirtKeys_.push_back(std::make_pair(virtualKeyCode, down));
|
||||
}
|
||||
|
||||
void EmuScreen::ProcessQueuedVKeys() {
|
||||
for (auto iter : queuedVirtKeys_) {
|
||||
std::vector<std::pair<VirtKey, bool>> dequeued;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(queuedVirtKeysLock_);
|
||||
dequeued = std::move(queuedVirtKeys_);
|
||||
queuedVirtKeys_.clear();
|
||||
}
|
||||
|
||||
for (auto iter : dequeued) {
|
||||
ProcessVKey(iter.first, iter.second);
|
||||
}
|
||||
queuedVirtKeys_.clear();
|
||||
}
|
||||
|
||||
// Synchronized processing of virtkeys.
|
||||
|
||||
@@ -154,6 +154,7 @@ private:
|
||||
|
||||
bool lastImguiEnabled_ = false;
|
||||
|
||||
std::mutex queuedVirtKeysLock_;
|
||||
std::vector<std::pair<VirtKey, bool>> queuedVirtKeys_;
|
||||
|
||||
ImGuiContext *ctx_ = nullptr;
|
||||
|
||||
Reference in new issue
Block a user