fixed panic on monitor plug/unplug: reversed for ranges in updateGeom underflowed on count change
Browse files
+2 −2 src/wm/wm.zig
| @@ -261,7 +261,7 @@ pub const WindowManager = struct { | ||
| 261 | 261 | |
| 262 | 262 | const new_count: usize = @intCast(nn); |
| 263 | 263 | |
| 264 | - for (n..new_count) |_| { | |
| 264 | + for (0..new_count -| n) |_| { | |
| 265 | 265 | var last = self.monitors; |
| 266 | 266 | while (last) |mon| { |
| 267 | 267 | if (mon.next == null) break; |
| @@ -313,7 +313,7 @@ pub const WindowManager = struct { | ||
| 313 | 313 | m = mon.next; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - for (new_count..n) |_| { | |
| 316 | + for (0..n -| new_count) |_| { | |
| 317 | 317 | var last: ?*Monitor = null; |
| 318 | 318 | var iter = self.monitors; |
| 319 | 319 | while (iter) |mon| { |