iced icon indicating copy to clipboard operation
iced copied to clipboard

.window_size(iced::Size::INFINITY) crashes on MacOS

Open dcampbell24 opened this issue 9 months ago • 9 comments

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?


dcampbell24 avatar Feb 08 '25 20:02 dcampbell24

I tested it on windows 11 and it works.

dcampbell24 avatar Feb 08 '25 21:02 dcampbell24

Why do you set the window size to infinite?

JL710 avatar Mar 28 '25 14:03 JL710

Because I want to maximize the window size, but I don't know what it is.

dcampbell24 avatar Mar 28 '25 18:03 dcampbell24

Why not maximizing with window::maximize?

JL710 avatar Mar 28 '25 20:03 JL710

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.

dcampbell24 avatar Mar 28 '25 21:03 dcampbell24

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.

pml68 avatar Mar 28 '25 22:03 pml68

Then why doesn't it crash on Windows or Linux?

dcampbell24 avatar Mar 28 '25 22:03 dcampbell24

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.

pml68 avatar Mar 28 '25 22:03 pml68

@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)

pml68 avatar Apr 28 '25 23:04 pml68

So set the window size to 10,000 on macOS when the user sets it to .window_size(iced::Size::INFINITY)?

dcampbell24 avatar Aug 16 '25 21:08 dcampbell24

Clamp the value if it's provided by the user, yes.

pml68 avatar Aug 16 '25 21:08 pml68

@pml68 thanks for your help fixing this issue.

dcampbell24 avatar Aug 16 '25 22:08 dcampbell24

As mentioned in the PR, programmer error.

hecrj avatar Nov 29 '25 13:11 hecrj