input-capture: Fix barrier validation without a monitor at (0.0)

For barrier validation, check_barrier() would start from the
(presumably) left-most monitor and walk the neighbor monitors to the
right.

This is assuming that there is always a monitor at (0.0), which is not
necessarily the case. If the first monitor on the left is not aligned at
the top, there is no logical monitor at (0.0) causing a NULL pointer
derefence.

Instead of starting from the monitor at (0,0), start from the primary
logical monitor, as there is necessarily one.

Fixes: 85885c6 - Check barriers don't extend into nonexisting monitors
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3272
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3562>
This commit is contained in:
Olivier Fourdan 2024-02-05 10:00:43 +01:00
parent a422ae022b
commit b8914da0c8

View File

@ -754,7 +754,7 @@ check_barrier (MetaInputCaptureSession *session,
MetaLogicalMonitor *next; MetaLogicalMonitor *next;
MtkRectangle layout, fake_layout; MtkRectangle layout, fake_layout;
monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager, 0, 0); monitor = meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
while ((next = meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager, monitor, META_DISPLAY_RIGHT))) while ((next = meta_monitor_manager_get_logical_monitor_neighbor (monitor_manager, monitor, META_DISPLAY_RIGHT)))
monitor = next; monitor = next;