Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Add null activeWorkspace check in moveWorkspaceToMonitor #9503

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

PlasmaPower
Copy link
Contributor

Describe your PR, what does it fix/add?

After I turn all monitors off with DPMS and then turn them back on, Hyprland would sometimes crash. I looked at a core dump and it seems to be just a missing null check (this backtrace is from Hyprland v0.47.2, it's from a release build with debug symbols):

#4  0x000064333164c1de in handleUnrecoverableSignal (sig=11) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/Compositor.cpp:108
#5  <signal handler called>
#6  0x000064333157f4cd in CCompositor::updateFullscreenFadeOnWorkspace (this=this@entry=0x643343adde30, pWorkspace=...) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/Compositor.cpp:2217
#7  0x0000643331666360 in CCompositor::moveWorkspaceToMonitor (this=0x643343adde30, pWorkspace=..., pMonitor=..., noWarpCursor=false) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/Compositor.cpp:2184
#8  0x0000643331752b99 in CMonitor::setupDefaultWS (this=0x643345249710, monitorRule=...) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/helpers/Monitor.cpp:869
#9  0x0000643331750055 in CMonitor::onConnect (this=0x643345249710, noRule=<optimized out>) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/helpers/Monitor.cpp:195
#10 0x0000643331670639 in CCompositor::onNewMonitor (this=0x643343adde30, output=...) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/Compositor.cpp:2982

As you can see from the backtrace, the new monitor's setupDefaultWS calls moveWorkspaceToMonitor but there isn't an active workspace of the monitor at that point.

(gdb) frame
#6  0x000064333157f4cd in CCompositor::updateFullscreenFadeOnWorkspace (this=this@entry=0x643343adde30, pWorkspace=...) at /usr/src/debug/hyprland/Hyprland-0.47.2/src/Compositor.cpp:2217
2217	    const auto FULLSCREEN = pWorkspace->m_bHasFullscreenWindow;
(gdb) p pWorkspace
$3 = {impl_ = 0x0}

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

I'm not sure on the exact conditions to replicate this issue so I'm not 100% sure it fully fixes the issue, but it definitely adds a needed null check where there wasn't one before.

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

Ready for merging

@github-actions github-actions bot added the core label Feb 27, 2025
@vaxerski vaxerski merged commit 34f2a47 into hyprwm:main Feb 28, 2025
12 checks passed
@PlasmaPower PlasmaPower deleted the null-active-workspace branch February 28, 2025 01:59
@littleblack111
Copy link
Contributor

related: #7822

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.

3 participants