[wayland] Destroy all ClientConnections on tear down

Ensures that all Wayland objects are destroyed and the cleanup handling
is performed before tearing down the Compositor. This fixes for example
a crash if a Surface with a Shadow is still around at tear down.
icc-effect-5.14.5
Martin Gräßlin 2015-11-18 10:29:10 +01:00
parent 12b63e2aa7
commit 3be016fba4
4 changed files with 14 additions and 3 deletions

View File

@ -73,7 +73,7 @@ WaylandTestApplication::~WaylandTestApplication()
}
waylandServer()->destroyXWaylandConnection();
}
waylandServer()->destroyInternalConnection();
waylandServer()->terminateClientConnections();
destroyCompositor();
}

View File

@ -97,7 +97,7 @@ ApplicationWayland::~ApplicationWayland()
}
waylandServer()->destroyXWaylandConnection();
}
waylandServer()->destroyInternalConnection();
waylandServer()->terminateClientConnections();
destroyCompositor();
}

View File

@ -91,6 +91,16 @@ void WaylandServer::destroyInternalConnection()
}
}
void WaylandServer::terminateClientConnections()
{
destroyInternalConnection();
destroyInputMethodConnection();
const auto connections = m_display->connections();
for (auto it = connections.begin(); it != connections.end(); ++it) {
(*it)->destroy();
}
}
void WaylandServer::init(const QByteArray &socketName, InitalizationFlags flags)
{
m_initFlags = flags;

View File

@ -72,6 +72,7 @@ public:
virtual ~WaylandServer();
void init(const QByteArray &socketName = QByteArray(), InitalizationFlags flags = InitalizationFlag::NoOptions);
void initOutputs();
void terminateClientConnections();
KWayland::Server::Display *display() {
return m_display;
@ -123,7 +124,6 @@ public:
bool isScreenLocked() const;
void createInternalConnection();
void destroyInternalConnection();
void initWorkspace();
KWayland::Server::ClientConnection *xWaylandConnection() const {
@ -156,6 +156,7 @@ Q_SIGNALS:
private:
quint16 createClientId(KWayland::Server::ClientConnection *c);
void destroyInternalConnection();
KWayland::Server::Display *m_display = nullptr;
KWayland::Server::CompositorInterface *m_compositor = nullptr;
KWayland::Server::SeatInterface *m_seat = nullptr;