Commit Graph

977 Commits

Author SHA1 Message Date
HP van Braam 7ab8328204 Don't flush the message queue before a MainLoop is iterating
Allowing this breaks several assumptions in the engine, normally this
doesn't occur but when using the WTP it can occur. For instance during
resource loading the message queue is serviced during tear down.

This means this situation can be created from user code if they do async
resource loading in the `_load` of a resource in the main scene.

This also makes the MainLoop report that it IS iterating during tests as
the tests expect the message queue to be serviced even though no main
loop is running.
2026-06-09 15:29:53 +02:00
Lukas Tenbrink 7852cb7887 Update GDCLASS / GDSOFTCLASS comments. 2026-05-08 23:47:35 +02:00
Enzo Novoselic 1b98247ef8 Fix RequiredResult<T> not being parsed properly by include-cleaner 2026-05-02 14:02:01 -04:00
HolonProduction 612475a680 GDScript: Track columns by raw string offsets 2026-04-26 21:32:46 +02:00
Thaddeus Crews 01603e77df Merge pull request #118678 from hpvb/fix-115173
Fix race in `RefCounted::unreference()`
2026-04-22 09:58:32 -05:00
Thaddeus Crews 92846d7c3e Merge pull request #112035 from Ivorforce/no-unsafe-new-overloads
Change `new` overloads to use a tag instead of a pointer
2026-04-20 09:15:47 -05:00
Thaddeus Crews e91640c755 Merge pull request #118773 from dsnopek/gdextension-placeholder-no-deprecated
GDExtension: Use `create_instance3` for placeholder classes
2026-04-20 09:15:38 -05:00
Lukas Tenbrink 9e43daa74d Change new overloads to use a tag instead of a pointer, which can lead to problems. Inline the new definition to save on a call. 2026-04-20 15:46:34 +02:00
David Snopek 10685b471e GDExtension: Use create_instance3 for placeholder classes
Co-authored-by: Mike Owens <mike@mikeowens.us>
2026-04-20 06:41:44 -05:00
David Snopek 470408515e GDExtension: Don't memdelete(gdtype) on placeholders 2026-04-19 12:25:51 -05:00
HP van Braam 6409ce6bb6 Fix race in RefCounted::unreference()
When two threads unreference() a RefCounted Object at the same time there's
a potential race.

Thread A sees rc_val == 1, enters the if() block.
Thread B sees rc_val == 0, enters the if() block.

Thread A gets scheduled out, or is simply scheduled on a slower core and
Thread B finishes, returning die = true. Thread B then frees the Object.

Some time during or after ~Object() Thread A wakes up and tries to call
methods on the Object, which is either destroyed or in the process of being
destroyed, leading to a use-after-free.

We fix the problem by counting how many threads are currently inside
the critical section, and blocking returning die = true as long as there are
still other threads potentially alive.

Tested by running with --test and by opening and playing various public and
private Godot projects.

This fixes #115173
2026-04-17 12:24:56 +02:00
Thaddeus Crews 790c68368f Merge pull request #118590 from Bromeon/feature/required-ptr-conversion
Add `RequiredParam` -> `RequiredResult` conversion
2026-04-16 09:41:12 -05:00
Thaddeus Crews 66dd6fe737 Merge pull request #118582 from Ivorforce/is_class_sn
Change `Object::is_class` to take `StringName` instead of `String`, for better performance
2026-04-15 14:02:32 -05:00
Lukas Tenbrink 299b0f69f9 Change Object::is_class to take StringName for better performance (intended for GDExtension casting and inheritance checks). 2026-04-15 13:08:43 +02:00
dillyo09 f313fa9a06 Build: Remove redundant SCons environment clones 2026-04-15 01:30:23 -07:00
Jan Haller 71d44651c4 Add RequiredParam -> RequiredResult conversion
Adds implicit conversion from `RequiredResult<T_Other>` to `RequiredParam<T>` (where
`T_Other` derives from `T`). This allows passing a `RequiredResult` directly to a
`RequiredParam` without an intermediate variable.

Also changes `SceneTree::get_root()` to return `RequiredResult<Window>`. It is used in a
conversion as described above.

Why non-null: The root window is created in the `SceneTree` constructor and only set to
null in the destructor, so it is always valid during normal use. The function is no longer
`_FORCE_INLINE_` because `RequiredResult<Window>` requires Window to be a complete type.
2026-04-15 01:23:48 +02:00
Thaddeus Crews 8f7bdc1722 Merge pull request #118214 from Ivorforce/gdext-init-refcount
Add `classdb_construct_object3` and `classdb_register_extension_class6` (refcount-aware inits)
2026-04-14 15:44:29 -05:00
kobewi f8cd68f283 Improve missing type error in ClassDB 2026-04-14 16:24:49 +02:00
David Snopek 4e79ddb81c GDExtension: Use real GDType in placeholder 2026-04-13 17:13:26 -05:00
Lukas Tenbrink c9279c1e53 Add classdb_construct_object3 and classdb_register_extension_class6, which are refcount-aware initialization functions (establishing RefCounted objects with a refcount of 1). 2026-04-12 12:29:04 +02:00
HolonProduction 97091c639b Deprecate ScriptLanguage::instance_has 2026-04-10 20:00:34 +02:00
Thaddeus Crews aa73f2c43f Merge pull request #117575 from Ivorforce/gdtype-signals-obj
Integrate `GDType` signal ownership into `Object`, exchanging use of `ClassDB`
2026-04-10 10:32:21 -05:00
Nolkaloid 1d165e7ea9 Add keyword code completion option 2026-04-08 20:04:08 +02:00
Lukas Tenbrink 098b35cca0 Integrate GDType signal ownership into Object, exchanging use of ClassDB. 2026-04-08 17:53:05 +02:00
Thaddeus Crews 7c720b815f Merge pull request #117710 from HolonProduction/lsp/text-edit-string
LSP: Calculate simple string insertions on the server-side
2026-04-06 13:02:20 -05:00
StarryWorm a88418e2ae Fix CI errors 2026-04-02 15:04:02 -04:00
Thaddeus Crews 7e911ad73a Merge pull request #118049 from Shadows-of-Fire/patch-1
Enable clang-tidy's performance-move-const-arg check
2026-04-01 12:55:18 -05:00
Shadows_of_Fire d89811d890 Enable clang-tidy's performance-move-const-arg check 2026-03-31 18:57:24 -04:00
kobewi d62f1c8900 Add type filters to create dialog 2026-03-31 17:17:23 +02:00
Thaddeus Crews 1bb4e60952 Merge pull request #115157 from Naros/script-extension-expose-reload-from-file
Delegate `Script::reload_from_file` to `ScriptLanguage`
2026-03-30 13:35:16 -05:00
HolonProduction 82f308d957 LSP: Calculate string insertions on the server-side 2026-03-25 14:53:31 +01:00
Rémi Verschelde 1951485a07 Merge pull request #109892 from Ryan-000/Bind-Object-ConnectFlags-as-a-bitfield-instead-of-enum-
Bind `Object::ConnectFlags` as a bitfield, instead of enum.
2026-03-23 22:33:43 +01:00
Thaddeus Crews 0e8bd28a10 CI: Implement clangd-tidy as GitHub Action 2026-03-20 09:16:38 -05:00
Thaddeus Crews fb4a304dee Merge pull request #111965 from Ivorforce/memnew-typed
Make `memnew(RefCounted)` return `Ref`, to improve ownership safety
2026-03-19 15:39:15 -05:00
StarryWorm 189c9497b3 split method_bind_common.h from method_bind.h 2026-03-18 17:41:32 -04:00
Lukas Tenbrink 05c33acbb1 Make memnew(RefCounted) return Ref, to force callers to take ownership of it through a reference. 2026-03-18 20:34:08 +01:00
Ryan 69f9e3a75c Bind Object::ConnectFlags as a bitfield, instead of enum. 2026-03-18 15:21:18 -04:00
Thaddeus Crews 4e7fefbf62 Merge pull request #117474 from Ivorforce/gdtype-signals
Move signal ownership from `ClassDB` to `GDType`
2026-03-18 11:43:30 -05:00
Rémi Verschelde e33e98a26f Style: Apply clang-format grouping rules 2026-03-17 20:11:01 +01:00
Mikael Hermansson 64f7bbbf12 Improve thread-safety of Object signals 2026-03-17 14:02:35 +01:00
Lukas Tenbrink 7a73d3f16b Move signal ownership from ClassDB to GDType. 2026-03-17 11:58:10 +01:00
Thaddeus Crews fc0960188b Merge pull request #111262 from leandro-benedet-garcia/separate-property-and-method-info
Separate Property and Method Info from Object files
2026-03-16 11:32:57 -05:00
Leandro (cerberus1746) Benedet Garcia 7482600828 Separate method and property info into separate files 2026-03-16 09:59:10 -03:00
Lukas Tenbrink 67f63addc1 De-duplicate name and inherits StringName properties from ClassDB::ClassInfo, in favour of GDType. 2026-03-15 16:57:10 +01:00
Rémi Verschelde 22decccd3f Merge pull request #115192 from Naros/script-api-fix-has-methods
Add `has_script_method` to `Script` for scripting access
2026-03-14 12:15:50 +01:00
Lukas Tenbrink efcc97ee8a Move enum registration from ClassDB / ClassInfo to GDType.
Create caches across supertypes for faster lookup.
2026-03-13 19:20:30 +01:00
Rémi Verschelde e015e8bde4 Remove unused includes in core with clangd-tidy 2026-03-11 06:41:36 +01:00
Yyf2333 282e4544b0 Split VariantCaster from binder_common.h 2026-03-10 17:59:33 +08:00
Rémi Verschelde 2dd1f4ef60 Decouple node.h from scene_tree.h, minimize its other includes 2026-03-05 13:54:46 +01:00
StarryWorm 3cb2d376f8 Get rid of all unnecessary class_db.h includers 2026-03-04 17:40:05 -05:00