diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2020-06-13 02:40:12 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2020-06-13 02:40:12 +0200 |
commit | 8e16d6e8114540f4b7975f7b2d96c7e6f63a89f2 (patch) | |
tree | df4c17701742bc99aaee84e061e0fbac37afb3b1 | |
parent | 59cbdbf34a0348fda0198d4b950ae084245383f6 (diff) |
video/ps3eye: fix lock contention on camera open
-rw-r--r-- | video-ps3eye/module.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/video-ps3eye/module.cpp b/video-ps3eye/module.cpp index 7266dc53..1d4e43f1 100644 --- a/video-ps3eye/module.cpp +++ b/video-ps3eye/module.cpp @@ -144,6 +144,7 @@ bool ps3eye_camera::start(info& args) return false; volatile auto& ptr = *(ps3eye::shm*)shm.ptr(); + QString error; using mode = ps3eye::shm_in::mode; @@ -181,14 +182,13 @@ bool ps3eye_camera::start(info& args) portable::sleep(sleep_ms); } - run_in_thread_sync(qApp, [&]() { - QString error; - if (ptr.out.error_string[0] == '\0') - error = "Unknown error"; - else - error = QString::fromLatin1((const char*)ptr.out.error_string, - strnlen((const char*)ptr.out.error_string, sizeof(ptr.out.error_string))); + if (ptr.out.error_string[0] == '\0') + error = "Unknown error"; + else + error = QString::fromLatin1((const char*)ptr.out.error_string, + strnlen((const char*)ptr.out.error_string, sizeof(ptr.out.error_string))); + run_in_thread_async(qApp, [=]() { QMessageBox::critical(nullptr, "Can't open camera", "PS3 Eye driver error: " + error, QMessageBox::Close); }); |