Skip to content

Commit 2587cd0

Browse files
calsys456wineee
authored andcommitted
fix: fix ddm stuck into dead event loop after crash recovery
The commit add deletion of old wayland objects if possible, during the connecting process of TreelandConnector, which can prevent ddm stuck into dead event loop of QSocketNotifier after crash recovery.
1 parent b0bf6e9 commit 2587cd0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/daemon/TreelandConnector.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ bool TreelandConnector::isConnected() {
128128
}
129129

130130
void TreelandConnector::setPrivateObject(struct treeland_ddm *ddm) {
131+
if (m_ddm) delete m_ddm;
131132
m_ddm = ddm;
132133
}
133134

@@ -166,7 +167,7 @@ void registerGlobal(void *data, struct wl_registry *registry, uint32_t name, con
166167
}
167168

168169
void removeGlobal([[maybe_unused]] void *data, [[maybe_unused]] struct wl_registry *registry, [[maybe_unused]] uint32_t name) {
169-
// Do not deregister the global object (set m_priv to null) here,
170+
// Do not deregister the global object (set m_ddm to null) here,
170171
// as wlroots will send global_remove event when session deactivated,
171172
// which is not what we want. The connection will be preserved after that.
172173
}
@@ -177,6 +178,12 @@ const struct wl_registry_listener registryListener {
177178
};
178179

179180
void TreelandConnector::connect(QString socketPath) {
181+
if (m_display) {
182+
wl_display_disconnect(m_display);
183+
QObject::disconnect(m_notifier, &QSocketNotifier::activated, nullptr, nullptr);
184+
delete m_notifier;
185+
}
186+
180187
m_display = wl_display_connect(qPrintable(socketPath));
181188
auto registry = wl_display_get_registry(m_display);
182189

0 commit comments

Comments
 (0)