Skip to content

Commit 1dc1f33

Browse files
andrei47wbindea-cristian
authored andcommitted
core: DeviceLoader: remove QThread::create() function
- this is a fix for android builds since QThread::create is not permitted Signed-off-by: Andrei Popa <[email protected]>
1 parent a5f1a6a commit 1dc1f33

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/src/deviceloader.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,26 @@ void DeviceLoader::init(bool async)
4343

4444
void DeviceLoader::asyncInit()
4545
{
46+
#ifdef __ANDROID__
47+
48+
QThread *th = new QThread();
49+
connect(
50+
th, &QThread::started, d,
51+
[=]() {
52+
// initializer thread
53+
d->init();
54+
th->quit(); // this replicates QThread::create behaviour of exiting the event loop after
55+
// executing the lambda function
56+
},
57+
Qt::QueuedConnection);
58+
59+
#else
4660
QThread *th = QThread::create([=] {
4761
// initializer thread
4862
d->init();
4963
});
64+
#endif
65+
5066
oldParent = d->parent();
5167
d->setParent(nullptr);
5268
d->moveToThread(th);

0 commit comments

Comments
 (0)