Skip to content

Fix memory safety and error handling issues#53

Open
RAprogramm wants to merge 4 commits intoHyDE-Project:devfrom
RAprogramm:52
Open

Fix memory safety and error handling issues#53
RAprogramm wants to merge 4 commits intoHyDE-Project:devfrom
RAprogramm:52

Conversation

@RAprogramm
Copy link

Summary

  • Replaced all unwrap()/expect() calls with proper error handling
  • Removed std::process::exit() in favor of graceful returns
  • Added comprehensive safety documentation for unsafe Send/Sync implementations
  • Documented Box::leak() usage and API constraints imposed by hyprland library
  • Fixed clippy warnings (unused lifetime, type complexity)
  • Added opt-level = 3 to release profile for maximum optimization

Changes

Error Handling

  • cli/src/keyword.rs: Replaced unwrap() with match expressions and error messages
  • cli/src/dispatch.rs: Added error handling for runtime creation
  • hyde-ipc-lib/src/service.rs: Replaced expect() and std::process::exit with Result propagation

Process Management

  • cli/src/listen.rs: Replaced std::process::exit(0) with graceful event counter that displays message when limit reached

Safety Documentation

  • hyprland-lib/src/unsafe_impl.rs: Added module-level and per-implementation safety documentation explaining thread safety guarantees
  • cli/src/dispatch.rs: Added documentation explaining Box::leak() usage due to hyprland API constraints
  • cli/src/parsers.rs: Added documentation for memory leak acceptability in CLI context

Code Quality

  • hyprland-lib/src/event_listener/shared.rs: Removed unused lifetime, added type alias for complex return type
  • Cargo.toml: Added opt-level = 3 to release profile

Testing

All changes maintain existing functionality while improving safety and code quality.

Closes #52

@kRHYME7
Copy link
Contributor

kRHYME7 commented Nov 17, 2025

@prime-run Hello

@RAprogramm
Copy link
Author

@kRHYME7 , Hi bro. I haven't seen you for a long time))) check out the hydebar repository. I want to make our own panel

@prime-run prime-run self-assigned this Nov 17, 2025
@prime-run prime-run changed the title 52 Fix memory safety and error handling issues Nov 17, 2025
@prime-run prime-run changed the base branch from master to dev November 17, 2025 18:01
@prime-run
Copy link
Collaborator

prime-run commented Nov 17, 2025

@RAprogramm thanks for the PR.
I changed the base branch to dev. please restore hyprland-lib/src/unsafe_impl.rs as it's not really necessary. And please make sure to format files you change before pushing (or just run cargo fmt at root project dir). Currently rustfmt.toml doesnt apply to :

cli/src/flags.rs
cli/src/main.rs
cli/src/react_config.rs

hxreborn and others added 4 commits November 18, 2025 07:32
Correct 'equivelant' -> 'equivalent' in shared.rs and
'prefered' -> 'preferred' in stream.rs.

No functional changes; documentation-only (comments).
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.

Fix memory safety and error handling issues

4 participants