Commit Graph

9484 Commits

Author SHA1 Message Date
Thaddeus Crews afdab2d6b3 Merge pull request #119394 from ManpreetXSingh/fix/double-ref
Fix Resources loaded using `ResourceLoader.load_threaded_get` are never unloaded
2026-05-11 10:59:50 -05:00
Manpreet Singh 9caa8180e9 fix: double ref 2026-05-11 08:08:21 +05:30
Lukas Tenbrink 7852cb7887 Update GDCLASS / GDSOFTCLASS comments. 2026-05-08 23:47:35 +02:00
Thaddeus Crews 599f2bd5b9 Merge pull request #118824 from hpvb/fix-118085
Fix a race in `ResourceLoader::load_threaded_request()`
2026-05-06 14:56:33 -05:00
Thaddeus Crews 3033644920 Merge pull request #119254 from Ivorforce/casts-are-so-4.6
Deprecate GDExtension's `object_cast_to` and `classdb_get_class_tag`, in favour of `is_class` casts.
2026-05-06 10:53:32 -05:00
Lukas Tenbrink 7c8df516ba Deprecate object_cast_to and classdb_get_class_tag, in favour of is_class. 2026-05-05 21:44:22 +02:00
HP van Braam f63ab5fbd9 Fix a race in ResourceLoader::load_threaded_request()
When multiple threads try to load the same sub-resource the
ResourceLoader's anti-deadlock protection thinks that the other threads
loading the dependency are old threads blocked on a dependency.

The current thread will then immediately start to load the sub-resource
since they can't wait for it. This can then lead to multiple threads
loading the same resource concurrently.

We fix the problem by recording in the task when loading has ACTUALLY
started, and if so we simply wait.

This is no worse than before, at the point where we are waiting now we
previously re-started the load entirely.

Tested by running the MRP from the below issue (with and without asan
and msan), and loading and running various public and private Godot
projects.

This also fixes a use-after-free on resource_changed_connections when
multiple threads end up running the same import. This is a pre-existing
bug but this code widened the race window.

This also fixes a pre-existing memory leak in load_threaded_request,
when the user calls the function we capture the Ref<LoadToken> but
immediately drop the ref. Causing the refcount to go to 1. Later in
_run_load_task we unreference manually, bringing the refcount to 0. This
then later prevents the Ref<> from memdeleting the LoadToken.

This fixes #118085
2026-05-05 15:11:05 +02:00
Dimitri Sukhankin e07737e0ba Add better error message when trying to decompress ZSTD with decompress_dynamic 2026-05-04 22:01:06 +04:00
Thaddeus Crews 176b795177 Merge pull request #119174 from StarryWorm/remove-classdb-pragmas
Fix pragma includes
2026-05-04 12:40:40 -05:00
Enzo Novoselic 1b98247ef8 Fix RequiredResult<T> not being parsed properly by include-cleaner 2026-05-02 14:02:01 -04:00
Thaddeus Crews 0b41f26b9b Merge pull request #119090 from ttencate/fix/issue_119085_shift_enter
Add Shift+Enter and Shift+KpEnter as default shortcuts for newline
2026-04-30 10:58:05 -05:00
Mikael Hermansson 6103c0bc42 Add error to error messages in FileAccessPack 2026-04-29 18:43:04 +02:00
Thomas ten Cate 50114457c5 Add Shift+Enter and Shift+KpEnter as default shortcuts for newline
These conflict with `ui_text_completion_replace` (accept autocompletion), but
the latter seems to take precedence if an autocomplete popup is open, so this
still works as expected.

Fixes #119085
2026-04-29 17:36:05 +02: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 0e25644655 Merge pull request #118796 from deralmas/gotta-go-wrap
Buildsystem: Simplify `format_buffer` utility method
2026-04-22 09:58:29 -05:00
Thaddeus Crews ba11d28426 Merge pull request #118055 from realbucketofchicken/ipv6-shortening
Fix regression when parsing a shortened IPv6 Address
2026-04-21 16:46:03 -05:00
Dery Almas e4dcf1d852 Buildsystem: Simplify format_buffer utility method
This method is used to generate headers for embedding files into the binary
(think about the new `#embed` feature in C23 and C++26).

While the stringification step itself was plenty fast, it then proceeded
to wrap everything using the `textwrap` module. `textwrap` is *very*
slow, as it's apparently optimized for human text.

This patch reimplements the wrapping logic using a simple regex,
resulting in a tremendous speed improvement (~6x), and switches to `map`
for the stringification itself (thanks Rémi!)

It also removes a (practically) unused argument, `initial_indent`.

The generated files are pretty much the same, with a tiny difference in
line length (for some reason the old logic overshot the requested line
length)
2026-04-21 23:18:42 +02:00
bucket 9e674ece11 fix shortened ipv6 parsing 2026-04-21 15:18:46 +02:00
Mister Ky 9eb3a04edf Finish mapping missing deprecated types for GDExtension 2026-04-21 00:45:59 +03:00
Thaddeus Crews b2b661d3bc Merge pull request #118750 from dsnopek/gdext-cleanup-register-extension-class6
GDExtension: Clean up types for new `classdb_register_extension_class6`
2026-04-20 14:31:56 -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 dd6a398e90 Merge pull request #118355 from allenwp/hdr-output-basic-project-setting
Change `display/window/hdr/request_hdr_output` project setting to be a basic setting.
2026-04-20 09:15:39 -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
David Snopek 7375ee7736 GDExtension: Clean up types for new classdb_register_extension_class6 2026-04-19 08:19:14 -05:00
Thaddeus Crews f1edeb4acc Merge pull request #118527 from KoBeWi/ignore_error_problem_fixed
Don't print UID errors when cache is not initialized
2026-04-18 07:28:36 -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 9b4b3831d2 Merge pull request #118588 from Bromeon/feature/more-required-ptrs
Use `RequiredParam`/`RequiredResult` in several more APIs
2026-04-16 09:41:13 -05: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
Kaleb Reid f973e3e346 Remove p_ and add r_ prefixes to argument names 2026-04-15 13:47:15 -07:00
Thaddeus Crews 3f63a400fa Merge pull request #118503 from m4gr3d/update_perfetto_tracing
Hook up `perfetto` script and frame profiling logic
2026-04-15 14:02:37 -05:00
Thaddeus Crews 37e53d7a54 Merge pull request #118609 from HolonProduction/rm-cmt
Remove obsolete header guard comment
2026-04-15 14:02:34 -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
HolonProduction 2be6fea3b0 Remove obsolete header guard comment 2026-04-15 15:26:26 +02: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
Fredia Huya-Kouadio 5ac1faf067 Hook up perfetto script and frame profiling logic 2026-04-14 16:22:37 -07:00
Jan Haller 773ee962ed Use RequiredParam/RequiredResult in several more APIs 2026-04-15 00:53:13 +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
Thaddeus Crews 15438d2d64 Merge pull request #117828 from lawnjelly/fti_fix_property_release_4
`FTI` - Fix property release updates
2026-04-14 07:11:06 -05:00
lawnjelly 6c82d74a28 FTI - Fix property release updates
Ensures properties are correctly updated to the server when being removed from the property update list.
2026-04-14 10:50:52 +01:00
David Snopek 4e79ddb81c GDExtension: Use real GDType in placeholder 2026-04-13 17:13:26 -05:00
Thaddeus Crews ee00d63bb2 Merge pull request #113905 from migueldeicaza/debugger-crash
Debugger: Rather than looping infinitely on data read errors, drop the connection.
2026-04-13 11:46:03 -05:00
Thaddeus Crews 8d80b74623 Merge pull request #118514 from bruvzg/be
Remove unused and broken big endian support code.
2026-04-13 11:46:02 -05:00
Thaddeus Crews 5adbdac72b Merge pull request #117025 from brandonhare/fix-imported-resource-script-class
Fix quick load for resources imported by editor import plugins
2026-04-13 11:45:57 -05:00