[libcalamaresui] Another allow-to-fall-back-to-eventloop

With 1 CPU, Calamares still spawns 9 threads or so: eventloop,
dbus loop, QML loop, ... many of those are invisible to the
application. Contention occurs on startup when the UI is constructed,
and we end up with the module manager creating widgets alongside,
or ahead of, the main window UI. This can result in deadlock:

 - in CalamaresApplication::initViewSteps
 - in QML imports

This is partly because the signal-slots connections get "deep":
from loadModules() we emit *modulesLoaded* which ends up showing
the main window in initViewSteps(). Avoid this with a QTimer:
drop back to the event loop and release whatever locks are held,
so the QML thread can get on with it already. Then the timer
goes off and the view steps are created.
This commit is contained in:
Adriaan de Groot 2020-09-22 16:24:45 +02:00
parent 705756b9bb
commit 8e9bf1c2a9

View File

@ -281,11 +281,13 @@ ModuleManager::loadModules()
if ( !failedModules.isEmpty() ) if ( !failedModules.isEmpty() )
{ {
ViewManager::instance()->onInitFailed( failedModules ); ViewManager::instance()->onInitFailed( failedModules );
emit modulesFailed( failedModules ); QTimer::singleShot( 10, [=]() {
emit modulesFailed( failedModules );
} );
} }
else else
{ {
emit modulesLoaded(); QTimer::singleShot( 10, this, &ModuleManager::modulesLoaded );
} }
} }