hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.71k stars 836 forks source link

Hyprland crashes (without a useful error message) when requesting a non-number monitor refresh rate #6249

Open kiriDevs opened 3 months ago

kiriDevs commented 3 months ago

System Info and Version

System/Version info ```sh # hyprctl systeminfo, without -c flag Hyprland, built from branch at commit cba1ade848feac44b2eda677503900639581c3f4 (props: bump version to 0.40.0). Date: Sat May 4 15:42:32 2024 Tag: v0.40.0, commits: 4606 flags: (if any) System Information: System name: Linux Node name: omitted Release: 6.9.1-arch1-2 Version: #1 SMP PREEMPT_DYNAMIC Wed, 22 May 2024 13:47:07 +0000 GPU information: c1:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 [1002:15bf] (rev c2) (prog-if 00 [VGA controller]) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ```

Bug or Regression?

Bug

Description

When supplying a resolution@refreshrate to a monitor statement where refreshrate is not a number, Hyprland crashes without any obvious error message.

This happens both when editing the config while Hyprland is running and on startup.

Perhaps there could be some handling in place to at least provide an error message hinting to an invalid value in the monitor statement for easier diagnosis.

How to reproduce

Put a monitor keyword into hyprland.conf, manually setting a resolution and refresh rate. Use some text in the refresh rate field.

Crash reports, logs, images, videos

hyprlandCrashReport995.txt

Micovec commented 3 months ago

I would also add to this:

Hyprland crashes almost every time (not checked all cases) when it's expecting number value but gets something else. I checked for it in the code and the reason is std::stoi, std::stof, ... are used by ConfigManager to parse strings to numbers which throw std::invalid_argument or std::out_of_range on invalid input. Those exceptions are not caught.

vaxerski commented 3 months ago

we probably should make a small util func that catches the error and returns it in such a case

izmyname commented 1 month ago

How's the fix, btw?