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

Fix sticky toggle crashes on maximized windows #1110

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

D-Brox
Copy link
Contributor

@D-Brox D-Brox commented Jan 2, 2025

Currently, after untoggling sticky while maximized, MaximizedState::original_layer remains with value ManagedLayer::Sticky, which can lead to a crash when unmaximizing the window by reaching an unreachable!() statement.

Closes #1074

@D-Brox D-Brox changed the title Fix sticky toggle on maximized windows Fix sticky untoggle crash on maximized windows Jan 2, 2025
@D-Brox
Copy link
Contributor Author

D-Brox commented Jan 4, 2025

After some testing on the first commit of this PR, I found this crash:

2025-01-04T11:26:42.209424-03:00 zuka cosmic-comp[8141]: thread 'main' panicked at 'assertion failed: was_floating.is_some() != was_tiled.is_some()': src/shell/mod.rs:2745#012
   0: <backtrace::capture::Backtrace as core::default::Default>::default#012
   1: log_panics::Config::install_panic_hook::{{closure}}#012
   2: std::panicking::rust_panic_with_hook#012
   3: std::panicking::begin_panic_handler::{{closure}}#012
   4: std::sys_common::backtrace::__rust_end_short_backtrace#012
   5: rust_begin_unwind#012
   6: core::panicking::panic_fmt#012
   7: core::panicking::panic#012   8: cosmic_comp::shell::Shell::move_request#012
   9: <core::option::Option<F> as calloop::sources::IdleDispatcher<Data>>::dispatch#012
  10: calloop::loop_logic::EventLoop<Data>::run#012
  11: cosmic_comp::main#012
  12: std::sys_common::backtrace::__rust_begin_short_backtrace#012  13: main#012
  14: __libc_start_call_main#012
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16#012
  15: __libc_start_main_impl#012
             at ./csu/../csu/libc-start.c:360:3#012  16: _start

I was able to cause the crash above multiple times using a combination of the sticky and maximize toggles in tiling mode with a window stack. At some point, the the surface was duplicated for the windows, one in tiling mode and one in floating mode, and moving them lead to the crashes.

Anyway, after some investigation I noticed the same thing as before was happening when toggling sticky while maximized, MaximizedState::original_layer didn't update to the value ManagedLayer::Sticky.

I couldn't replicate the crash after my second commit, so I'm pretty sure both crashes related to sticky+maximize are fixed now.

@D-Brox D-Brox changed the title Fix sticky untoggle crash on maximized windows Fix sticky toggle crashes on maximized windows Jan 4, 2025
Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. Seems good to me!

@Drakulix Drakulix merged commit 68b6156 into pop-os:master Jan 6, 2025
@D-Brox D-Brox deleted the fix/sticky branch January 8, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Crashes after maximizing a sticky window and untoggling sticky
2 participants