Skip to content

Commit 9ad1892

Browse files
committed
Fix build.
1 parent 93e974d commit 9ad1892

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Common/Cpp/LifetimeSanitizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ namespace PokemonAutomation{
2626
const std::set<std::string> SANITIZER_FILTER = {
2727
// "MultiSwitchProgramSession",
2828
// "MultiSwitchProgramWidget2",
29+
// "VideoSource",
2930
};
3031

3132
SpinLock sanitizer_lock;

Common/Qt/Redispatch.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ void queue_on_main_thread(std::function<void()> lambda){
2222

2323

2424
void run_on_main_thread_and_wait(std::function<void()> lambda){
25-
if (QCoreApplication::instance()->thread() == QThread::currentThread()){
25+
run_on_object_thread_and_wait(QCoreApplication::instance(), std::move(lambda));
26+
}
27+
28+
void run_on_object_thread_and_wait(QObject* object, std::function<void()> lambda){
29+
if (object->thread() == QThread::currentThread()){
2630
lambda();
2731
return;
2832
}
2933

3034
std::mutex lock;
3135
std::condition_variable cv;
3236
bool done = false;
33-
QMetaObject::invokeMethod(QCoreApplication::instance(), [&]{
37+
QMetaObject::invokeMethod(object, [&]{
3438
lambda();
3539
std::lock_guard<std::mutex> lg(lock);
3640
done = true;
@@ -42,4 +46,5 @@ void run_on_main_thread_and_wait(std::function<void()> lambda){
4246

4347

4448

49+
4550
}

Common/Qt/Redispatch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#include <functional>
1111

12+
class QObject;
13+
1214
namespace PokemonAutomation{
1315

1416

@@ -18,6 +20,7 @@ void queue_on_main_thread(std::function<void()> lambda);
1820

1921

2022
void run_on_main_thread_and_wait(std::function<void()> lambda);
23+
void run_on_object_thread_and_wait(QObject* object, std::function<void()> lambda);
2124

2225

2326

0 commit comments

Comments
 (0)