Make the last commit slightly safer by adding a mutex
This commit is contained in:
parent
0926cabb00
commit
f77ba7ba3a
2 changed files with 11 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue