-
-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
Allow up to INT32_MAX max size in Array/Dictionary editor #77225
Conversation
Also accidentally setting this size too high will cause errors as you run out of memory, not very user friendly, 2^53 entry arrays is some 144 petabytes, this would make it possible to attempt to make arrays taking some 2.8*10^309 bytes (twice as large if you use doubles) But in any case |
@@ -311,7 +311,7 @@ void EditorPropertyArray::update_property() { | |||
|
|||
size_slider = memnew(EditorSpinSlider); | |||
size_slider->set_step(1); | |||
size_slider->set_max(1000000); | |||
size_slider->set_max(DBL_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment on this value, cannot be larger than INT_MAX
or 0x7fffffff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I was doing more diving into the codebase and was looking at where it was actually used and it would be better to use a integer value instead. Would you still recommend INT_MAX over something like UINT32_MAX? I don't know a case where you would need a negative array size and there are a few spots where I see the size being cast to a unsigned 32 bit integer anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a signed integer so not UINT32_MAX
, the resize
function takes int
so don't think it's safe, the use of int
for size across the codebase is a bit odd but let's stick to using it safely
I'm not sure if there's any use of INT32_MAX
in the codebase but it's an optional constant so using INT_MAX
or the actual value might be more portable
Edit: It has been used in various locations so it should be safe to just use INT32_MAX
You have duplicate and redundant commits, you will need to squash these, see here And update the PR name and description to reflect the changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some editor maintainer will have to give their opinion on if this is a good range but it makes sense to me and makes any exported array usable in the editor
Yea I'm currently doing that. It's just been a minute since I've done a large rebase and squash in general. Thanks for the heads up though. |
Quick update to editor/editor_properties_array_dict max size. Currently, an array in the EditorInspector won't display a number higher than 1,000,000. In place of the current magic number this sets the max to be the INT32_MAX. This eludes the magic number in place and is sufficiently large. Resolves godotengine#77190
Remember to update the PR description and title |
Thanks! And congrats for your first merged Godot contribution 🎉 |
Cherry-picked for 4.0.4. |
Quick update to editor_properties_array_dict max size. An array in the EditorInspector won't display a number higher than 1,000,000. The Range::Shared max value is stored in a double, as such the new max value has been updated to be DBL_MAX instead of an arbitrary magic number.
Resolves #77190