Skip to content

xwayland: Init DnD on every Xwayland start

Olivier Fourdan requested to merge ofourdan/mutter:issue-2168 into main

Currently, meta_xwayland_shutdown_dnd() is called from the handler on_x11_display_closing() triggered from the signal "x11-display-closing" hooked up from meta_xwayland_init_display().

Once the signal has been triggered, on_x11_display_closing() removes the signal handler, disconnecting from the signal.

As meta_xwayland_init_display() is called from meta_display_new() which is issued only once, the signal handler is not restored again.

As a result, meta_xwayland_shutdown_dnd() is not called anymore after Xwayland has been restarted, but meta_xwayland_init_dnd() will check and assert that the manager's DND object is NULL.

Basically, restarting Xwayland more that once will trigger an assertion failure in mutter. That's even more of a problem with autoclose-xwayland where Xwayland is expected to terminate when there is no meaningful X11 client remaining, which can happen multiple times during the lifetime of a user session.

To make sure that meta_xwayland_init_display() is called for every new instance of Xwayland, simply keep the signal hooked in place by not disconnecting it when triggered.

This reverts commit 9a10b8ff.

Even though, originally, this issue was first introduced with commit b4fe1fdd ("xwayland: Make setup/teardown a bit more symmetrical") which didn't actually kept 'x11-display-setup' and 'x11-display-closing' connected.

Closes: #2168 (closed)

cc @carlosg

Edited by Olivier Fourdan

Merge request reports