Wayland: Fix crash when enabling disabling monitors on sway

When an output is unregistered, the corresponding monitor object should
be removed from every windows' monitor list

Proper fix for #1696
This commit is contained in:
Kovid Goyal 2019-06-07 12:40:02 +05:30
parent 3c7a71772c
commit e846bc9308
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 2 deletions

View File

@ -43,6 +43,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
server side window decorations, such a GNOME or Weston not working server side window decorations, such a GNOME or Weston not working
correctly (:iss:`1659`) correctly (:iss:`1659`)
- Wayland: Fix crash when enabling disabling monitors on sway (:iss:`1696`)
0.14.1 [2019-05-29] 0.14.1 [2019-05-29]
--------------------- ---------------------

10
glfw/wl_init.c vendored
View File

@ -613,14 +613,20 @@ static void registryHandleGlobalRemove(void *data,
struct wl_registry *registry, struct wl_registry *registry,
uint32_t name) uint32_t name)
{ {
int i;
_GLFWmonitor* monitor; _GLFWmonitor* monitor;
for (i = 0; i < _glfw.monitorCount; ++i) for (int i = 0; i < _glfw.monitorCount; ++i)
{ {
monitor = _glfw.monitors[i]; monitor = _glfw.monitors[i];
if (monitor->wl.name == name) if (monitor->wl.name == name)
{ {
for (_GLFWwindow *window = _glfw.windowListHead; window; window = window->next) {
for (int m = window->wl.monitorsCount - 1; m >= 0; m--) {
if (window->wl.monitors[m] == monitor) {
remove_i_from_array(window->wl.monitors, m, window->wl.monitorsCount);
}
}
}
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0); _glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
return; return;
} }