mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Make the last commit slightly safer by adding a mutex
This commit is contained in:
parent
0926cabb00
commit
f77ba7ba3a
@ -18,6 +18,7 @@
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
|
||||
#include "base/mutex.h"
|
||||
#include "base/colorutil.h"
|
||||
#include "base/logging.h"
|
||||
#include "i18n/i18n.h"
|
||||
@ -437,6 +438,9 @@ bool AnalogTestScreen::key(const KeyInput &key) {
|
||||
screenManager()->finishDialog(this, DR_BACK);
|
||||
return true;
|
||||
}
|
||||
|
||||
lock_guard guard(eventLock_);
|
||||
|
||||
char buf[512];
|
||||
snprintf(buf, sizeof(buf), "Keycode: %d Device ID: %d [%s%s%s%s]", key.keyCode, key.deviceId,
|
||||
(key.flags & KEY_IS_REPEAT) ? "REP" : "",
|
||||
@ -457,6 +461,8 @@ bool AnalogTestScreen::axis(const AxisInput &axis) {
|
||||
// a controller would be confusing for the user.
|
||||
char buf[512];
|
||||
|
||||
lock_guard guard(eventLock_);
|
||||
|
||||
if (IgnoreAxisForMapping(axis.axisId))
|
||||
return false;
|
||||
|
||||
@ -476,6 +482,8 @@ bool AnalogTestScreen::axis(const AxisInput &axis) {
|
||||
void AnalogTestScreen::CreateViews() {
|
||||
using namespace UI;
|
||||
|
||||
lock_guard guard(eventLock_);
|
||||
|
||||
I18NCategory *di = GetI18NCategory("Dialog");
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include "base/functional.h"
|
||||
#include "base/mutex.h"
|
||||
#include "ui/view.h"
|
||||
#include "ui/ui_screen.h"
|
||||
|
||||
@ -80,4 +81,6 @@ protected:
|
||||
|
||||
UI::TextView *lastKeyEvent_;
|
||||
UI::TextView *lastLastKeyEvent_;
|
||||
|
||||
recursive_mutex eventLock_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user