Skip to content

Fix ClassDB iterators making unintended copies - #1774

Merged
dsnopek merged 1 commit into
godotengine:masterfrom
BenLubar:unintended-copy
Apr 29, 2025
Merged

dsnopek merged 1 commit into
godotengine:masterfrom
BenLubar:unintended-copy

Conversation

@BenLubar

Copy link
Copy Markdown
Contributor
godot-cpp/src/core/class_db.cpp: In static member function 'static void godot::ClassDB::_editor_get_classes_used_callback(GDExtensionTypePtr)':
godot-cpp/src/core/class_db.cpp:395:88: error: loop variable 'pair' of type 'const std::pair<godot::StringName, const GDExtensionInstanceBindingCallbacks*>&' binds to a temporary constructed from type 'std::pair<const godot::StringName, const GDExtensionInstanceBindingCallbacks*>' [-Werror=range-loop-construct]
  395 | ame, const GDExtensionInstanceBindingCallbacks *> &pair : instance_binding_callbacks) {
      |                                                    ^~~~

godot-cpp/src/core/class_db.cpp:395:88: note: use non-reference type 'const std::pair<godot::StringName, const GDExtensionInstanceBindingCallbacks*>' to make the copy explicit or 'const std::pair<const godot::StringName, const GDExtensionInstanceBindingCallbacks*>&' to prevent copying

@BenLubar
BenLubar requested a review from a team as a code owner April 21, 2025 23:47
@dsnopek dsnopek added the bug This has been identified as a bug label Apr 29, 2025
@dsnopek dsnopek added this to the 4.x milestone Apr 29, 2025

@dsnopek dsnopek left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

This error started happening on our CI as well, and this PR fixes it :-)

@dsnopek
dsnopek merged commit 543c1f7 into godotengine:master Apr 29, 2025
@dsnopek

dsnopek commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator

Cherry-picked for 4.3 in PR #1803

@dsnopek

dsnopek commented Jun 24, 2025

Copy link
Copy Markdown
Collaborator

Cherry-picked for 4.4 in PR #1805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This has been identified as a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants