From 3031aecb199a778fa97c358a3b34f261f15ac503 Mon Sep 17 00:00:00 2001 From: Andrei Popa Date: Tue, 26 Aug 2025 17:05:18 +0300 Subject: [PATCH] core: DeviceLoader: remove QThread::create() function - this is a fix for android builds since QThread::create is not permitted Signed-off-by: Andrei Popa --- core/src/deviceloader.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/src/deviceloader.cpp b/core/src/deviceloader.cpp index d6b864420c..61c81874f6 100644 --- a/core/src/deviceloader.cpp +++ b/core/src/deviceloader.cpp @@ -43,10 +43,26 @@ void DeviceLoader::init(bool async) void DeviceLoader::asyncInit() { +#ifdef __ANDROID__ + + QThread *th = new QThread(); + connect( + th, &QThread::started, d, + [=]() { + // initializer thread + d->init(); + th->quit(); // this replicates QThread::create behaviour of exiting the event loop after + // executing the lambda function + }, + Qt::QueuedConnection); + +#else QThread *th = QThread::create([=] { // initializer thread d->init(); }); +#endif + oldParent = d->parent(); d->setParent(nullptr); d->moveToThread(th);