Set WAYLAND_DISPLAY before starting wayland server

Apparently, zink (when calling gbm_create_device()) may connect to the
wayland server if the WAYLAND_DISPLAY envvar is set and deadlock.


(cherry picked from commit d802b7c32c)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
wilder/Plasma/6.2
Vlad Zahorodnii 1 year ago
parent 9370f7d19e
commit 5275c31819
  1. 6
      src/main_wayland.cpp
  2. 7
      src/wayland_server.cpp

@ -593,11 +593,6 @@ int main(int argc, char *argv[])
}
QObject::connect(&a, &KWin::Application::workspaceCreated, server, &KWin::WaylandServer::initWorkspace);
if (!server->socketName().isEmpty()) {
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), server->socketName());
qputenv("WAYLAND_DISPLAY", server->socketName().toUtf8());
}
a.setProcessStartupEnvironment(environment);
#if KWIN_BUILD_X11
if (parser.isSet(xwaylandOption)) {
@ -627,6 +622,7 @@ int main(int argc, char *argv[])
}
#endif
a.setProcessStartupEnvironment(environment);
a.setApplicationsToStart(parser.positionalArguments());
a.setInputMethodServerToStart(parser.value(inputMethodOption));
a.start();

@ -318,6 +318,13 @@ void WaylandServer::handleOutputDisabled(Output *output)
bool WaylandServer::start()
{
QProcessEnvironment environment = kwinApp()->processStartupEnvironment();
if (!socketName().isEmpty()) {
environment.insert(QStringLiteral("WAYLAND_DISPLAY"), socketName());
qputenv("WAYLAND_DISPLAY", socketName().toUtf8());
}
kwinApp()->setProcessStartupEnvironment(environment);
return m_display->start();
}

Loading…
Cancel
Save