iced
iced copied to clipboard
.window_size(iced::Size::INFINITY) crashes on MacOS
Is your issue REALLY a bug?
- [x] My issue is indeed a bug!
- [x] I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.
Is there an existing issue for this?
- [x] I have searched the existing issues.
Is this issue related to iced?
- [x] My hardware is compatible and my graphics drivers are up-to-date.
What happened?
I loaded my application on Linux and it works fine, but when I run it on MacOS it crashes. If I comment out the line .window_size(iced::Size::INFINITY) it works again.
What is the expected behavior?
The application will run.
Version
crates.io release
Operating System
macOS
Do you have any log output?
I tested it on windows 11 and it works.
Why do you set the window size to infinite?
Because I want to maximize the window size, but I don't know what it is.
Why not maximizing with window::maximize?
Then you have to take an action to maximize the window? (I wanted it to start out maximized, but anyway now I have it so the window starts out at the standard size, then you can maximize it if you want to.) I'm leaving this issue open as it seems like an error, even if I don't encounter it anymore.
I'd think an app crashing when you set the window size to infinite is perfectly understandable. You can just return the task in your initializer method, so it happens before anything else.
Then why doesn't it crash on Windows or Linux?
No idea. You could check the source, should be in winit. Lots of windowing-related things are very OS-specific, so without checking I can't really tell you.
@dcampbell24 you probably don't care about it at this point, but while going through some stuff in winit, I also found the source of this. Here's the Apple documentation: https://developer.apple.com/documentation/appkit/nswindow/init(contentrect:stylemask:backing:defer:)#parameters (specifically contentRect)
So set the window size to 10,000 on macOS when the user sets it to .window_size(iced::Size::INFINITY)?
Clamp the value if it's provided by the user, yes.
@pml68 thanks for your help fixing this issue.
As mentioned in the PR, programmer error.