Skip to content

Commit 3fa7c65

Browse files
committed
Merge pull request godotengine#108504 from precup/optimize-duplicate
Avoid unnecessary copy in ClassDB::get_property_list
2 parents d5512df + 047edb8 commit 3fa7c65

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

core/object/class_db.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,13 +1542,9 @@ void ClassDB::get_property_list(const StringName &p_class, List<PropertyInfo> *p
15421542
ClassInfo *check = type;
15431543
while (check) {
15441544
for (const PropertyInfo &pi : check->property_list) {
1545+
p_list->push_back(pi);
15451546
if (p_validator) {
1546-
// Making a copy as we may modify it.
1547-
PropertyInfo pi_mut = pi;
1548-
p_validator->validate_property(pi_mut);
1549-
p_list->push_back(pi_mut);
1550-
} else {
1551-
p_list->push_back(pi);
1547+
p_validator->validate_property(p_list->back()->get());
15521548
}
15531549
}
15541550

0 commit comments

Comments
 (0)