Fix startup when running with ASAN

We can't call kwinApp() before KWin::Application hasn't been properly
initialized.
This commit is contained in:
Aleix Pol 2021-04-22 17:28:53 +02:00 committed by Aleix Pol Gonzalez
parent 3b66e634f9
commit b372de8c74

View file

@ -76,8 +76,15 @@ bool Integration::hasCapability(Capability cap) const
void Integration::initialize()
{
// This method is called from QGuiApplication's constructor, before kwinApp is built
QTimer::singleShot(0, this, [this] {
// The QPA is initialized before the platform plugin is loaded.
if (kwinApp()->platform()) {
handlePlatformCreated();
} else {
connect(kwinApp(), &Application::platformCreated, this, &Integration::handlePlatformCreated);
}
});
QPlatformIntegration::initialize();