Skip to content

recheckWorkArea() even when not active to prevent CReservedArea assert failure#13590

Open
logannc wants to merge 1 commit intohyprwm:mainfrom
logannc:lc/recheck_on_move
Open

recheckWorkArea() even when not active to prevent CReservedArea assert failure#13590
logannc wants to merge 1 commit intohyprwm:mainfrom
logannc:lc/recheck_on_move

Conversation

@logannc
Copy link

@logannc logannc commented Mar 5, 2026

Describe your PR, what does it fix/add?

This fixes a crash under a fairly niche but core use case involving multiple monitors. Ultimately it leads to violating the assertion in CReservedArea.

Steps to reproduce the crash

  1. Configure a window to spawn on a workspace that we won't visit. e.g., exec-once = [workspace 33 silent] uwsm app -- signal-desktop in my case
  2. For some reason, hyprland initializes this on monitor ID 2 at offset 0x0 at 4K with scale 2. That's not where I want it! I want it on monitor ID 1 at offset 5760x0 at 1080p with scale 1. (as an example)
  3. Do not navigate to workspace 33, as there is an interaction with last focused window. (explained below)
  4. With monitor ID 1 focused, run hyprctl dispatch focusworkspaceoncurrentmonitor 33.

It should crash due to the workspace work area being stale due to recheckWorkArea() not being called in this path, with the old stale work area reflecting the original monitor, which is not contained within the coordinates on the new monitor.

Note: this doesn't crash when active due to recalculateMonitor() inside the SWITCHINGISACTIVE branch ~L2017.

Note: this doesn't crash when the workspace has had a focused window due to skipping getTopLeftWindow() and getWindowIdealBoundingBoxIgnoreReserved() when pWindow is non-null. (or I guess when there is a fullscreen window).

This was discovered using a plugin called hyprsplit (currently running off my own branch), but per above is reproducible on hyprland without the plugin.

Is it ready for merging, or does it need work?

I'm not 100% sure. I'm not 100% sure how to test this. I have read the dev setup but I'm not sure how to test multiple monitors in the dev setup (and the easiest way to reproduce involves violating the suggestions of "don't use exec-once") nor how to run my branch on an actual login session on my computer.

If this PR is not correct, I'm happy to convert it to a bugreport for someone more familiar with the codebase to take on.

I'm also not incredibly familiar with the standard hyprland lifecycle patterns, so perhaps recheckWorkArea() or a similar function should be hoisted to a calling function or something.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Hello and thank you for making a PR to Hyprland!

Please check the PR Guidelines and make sure your PR follows them.
It will make the entire review process faster. :)

If your code can be tested, please always add tests. See more here.

beep boop, I'm just a bot. A real human will review your PR soon.

@github-actions github-actions bot added the core label Mar 5, 2026
@logannc logannc marked this pull request as ready for review March 5, 2026 22:06
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should be added to swap too?

@logannc
Copy link
Author

logannc commented Mar 6, 2026

probably should be added to swap too?

Looks like it should be fine as it calls g_layoutManager->recalculateMonitor(...) on both, which calls recheckWorkArea() internally.

@logannc logannc requested a review from vaxerski March 6, 2026 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants