Commit Graph
9514 Commits
Author SHA1 Message Date
Lukas Tenbrink 7f23e878f3 Fix register_extension_class never iterating parents for exposed checks.
(cherry picked from commit 2b68af596bbba870c29657dc6dd7577b2c97edaf)
2026-08-12 11:26:27 -05:00
fuyingdi 1644b09d96 Fix Color hash component order
(cherry picked from commit 2acda9628a653a0f43ebf585cfde55455422e294)
2026-07-30 11:26:21 -05:00
Ky 8c6e403752 Update DirAccess::create_temp to not fail on empty prefix parameter
Fixes #121314

(cherry picked from commit 16df2a28dbd3afe3d93d5a574d4d965961d988cf)
2026-07-30 11:26:20 -05:00
Aaron Franke 2906aa0e6d Fix crash when failing to open log file for writing
(cherry picked from commit 7a5d61816c95c64a905e46480ffec3a5af880a5a)
2026-07-30 11:26:20 -05:00
Lukas Tenbrink 17cd7dbac7 Make it impossible to have more than one main thread.
(cherry picked from commit 2ff661cd8d9b229b6a8d0e64ccd9cb52e92c1315)
2026-07-30 11:26:19 -05:00
Lukas Tenbrink f9aa898e74 Add set_if_clear() and clear_if_set() to SafeFlag, to conditionally trigger the flag.
(cherry picked from commit 1f18494d0241169422ee1c7f4d104a35738e8ec3)
2026-07-30 11:26:19 -05:00
Thaddeus Crews 73635de7f9 Merge pull request #121759 from Faless/mbedtls/always_use_our_entropy
[4.7] mbedTLS: Always use Godot's OS as entropy source
2026-07-30 10:43:55 -05:00
Cyklon_3000 e81a78b11d Fix error handling for negative values in RandomPCG::rand_weighted
(cherry picked from commit f80a9820afa420e08448213cbf89a3578b8109af)
2026-07-25 13:19:51 -05:00
Aaron Franke 5bea0666b4 Fix more MSVC warnings for potential mod by 0 (C4724)
(cherry picked from commit 6f072b22896fee293b99100fd83d0b9e2a183058)
2026-07-25 11:39:49 -05:00
Fabio Alessandrelli 2feb964541 mbedTLS: Always use Godot's OS as entropy source
mbedTLS < 4 provides internal platform functions to seed the random
number generator with entropy from the OS.

Historically we have been relying on this when the mbedTLS module is
enabled, while we have been using the OS::get_entropy when building
without the module.

Given we had issues on some platform with the built-in implementation,
this commit forces the use of OS::get_entropy in all cases (module or
not).

This is already the case when using mbedTLS 4 (Godot 4.8+).
2026-07-25 10:19:08 +02:00
Bryce Hutchings f0da549104 commit to method ptr once to avoid corrupting another thread in certain race conditions
(cherry picked from commit bc5dee8f27de51c9f27ac8b886c1381d8f491a4f)
2026-07-13 10:56:07 -05:00
Thaddeus Crews 61fe4ec801 Core: Fix MSVC compilation with Tracy
(cherry picked from commit 2aaa46b9d18ff42c315a32043274039b08b3448f)
2026-07-13 10:56:06 -05:00
Pāvels Nadtočajevs a1649d854c Do not inline new operators.
(cherry picked from commit 75e0f205f2e783df2fcd054e6683a4c07c1c85da)
2026-06-23 08:33:33 -05:00
Lukas Tenbrink 97ef21eacd Fix UDP server peer connections. 2026-06-17 18:21:44 +02:00
HP van Braam b527505338 Revert "Fix a deadlock in WorkerThreadPool"
This turned out to break a lot of things in the engine unexpectedly. The
actual deadlock that this fixes seems rare so a better approach is
needed.

For 4.7 we should drop this one.

This reverts commit ae564feb2a.
This reverts commit 7ab8328204.
2026-06-12 20:09:27 +02:00
HP van Braam ae564feb2a Fix a deadlock in WorkerThreadPool
When the main thread is waiting on a worker thread pool via
WorkerThreadPool::wait_for_group_task_completion() the MessageQueue is no
longer being serviced.

But in ResourceLoader::_load_complete_inner we need to be able to push a
callable onto the MessageQueue and we wait until completion. Effectively
waiting on the main thread to run our code.

If the tasking waiting on completion is in the group the main thread is
waiting for then this can never happen.

We solve this problem by servicing the MessageQueue in the
WorkerThreadPool if main thread is waiting. To avoid busy waiting on the
semaphore we sleep for a very brief time to spare battery without impacting
latency too much in the waiting case.
2026-06-10 12:46:42 +02:00
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
HP van Braam b88a62f805 Fix ResourceLoader deadlocks
This fixes several issues:
 * There was a bug in the cycle detection. It was possible for the cycle
   detection to fail because the current thread isn't in the list. Fix
   this by just seeing if any of the next threads were already in the
   cycle.
 * By way of an optimization the thread_waiting_on bookkeeping was done
   under the same thread_load_mutex as the cycle detection. But there is
   also an early exit after yields. If we exit through the yield the
   thread_waiting_on entry is stale and can cause other threads to fail
   to do cycle detection.
 * When multiple threads end up finishing a resource simultaneously
   anyway, probably through cycle detection, there's a small chance that
   the original thread finished more-or-less at the same time if the
   original thing blocking load completed. We solve this now by letting
   only one of the threads do the initial registration.
2026-06-08 04:57:26 +02:00
Thaddeus Crews 93d16cc84c Merge pull request #119757 from hpvb/fix-threaded-loader-again
Fix `ResourceLoader::load_threaded_get()` deadlocks
2026-05-29 10:47:41 -05:00
Thaddeus Crews bc209b4f1d Merge pull request #119598 from nikitalita/ensure-bptc-textures
Ensure that BPTC LayeredTexture images get compressed with same signedness
2026-05-29 10:47:39 -05:00
HP van Braam 374102cfbe Fix ResourceLoader::load_threaded_get() deadlocks
This fixes several issues in ResourceLoader
 * When waiting on resources being loaded on the main thread it is
   possible that the resource was waiting on the message queue. Flush
   the message queue in this situation. This was an existing bug.
 * When re-starting a load for deadlock-prevention reasons, and this
   type of resource has nested resources and uses resource changed
   connections we end up with references to resourcese being deleted
   as duplicates in the dependent task. We now keep a reference to these
   resources for the duration of the dependent load task. This closes
   the race but does not entirely eliminate it during intial import.
   This is an existing bug seemingly specific to TileSetSource but there
   might be others.
 * When threads are waiting during teardown we ended up deadlocking
   because the waiting thread would never end up completing. This is a
   bug introduced by f63ab5f
 * When a thread loading a resource ends up calling back into the
   WorkerThreadPool to wait cooperatively it expects that other threads
   complete, or new requests are made, so that work moves forward. If
   all OTHER threads end up blocked by the WorkerThreadPool waiting
   thread then no forward progress can be made anymore. We now solve
   this problem by yielding whenever we are blocked by another task. We
   wake up each every task whenever any progress is made to see if
   further progress can be made. This is a bug introduced by f63ab5f
 * When dependencies get introduced while loading it is possible to form
   a dependency cycle. Normally this isn't a problem but when all
   threads are already waiting when the cycle is introduced no forward
   progress can be made anymore. We now break such cycles. This is a bug
   introduced by f63ab5f
2026-05-29 16:12:02 +02:00
Thaddeus Crews 6137953493 Merge pull request #119651 from Ivorforce/clarify-hash-compare
Clarify `hash_compare` semantics on `Variant`.
2026-05-22 10:57:56 -05:00
Lukas Tenbrink 103b82048f Clarify hash_compare semantics on Variant. 2026-05-22 12:00:02 +02:00
nikitalita 3a49491ff0 Ensure that BPTC LayeredTexture images get compressed with same signedness 2026-05-19 23:04:00 -07:00
Pāvels Nadtočajevs 735827bd78 [Import] Fix empty columns importing as invalid English translation. 2026-05-19 14:48:41 +03:00
Thaddeus Crews 2c5bdd1f9c Merge pull request #119510 from van800/shakhov/fixes
open_dynamic_library(String(), library, &data) should only be called for apple
2026-05-18 11:06:26 -05:00
Thaddeus Crews 8ae90e9442 Merge pull request #119495 from m4gr3d/fix_main_path_use_for_android
[Android] Fix the use of `--main-pack` in template builds
2026-05-18 11:06:25 -05:00
Ivan Šachovandbruvzg e744959de5 avoiding an incorrect ERR_FILE_NOT_FOUND report when the DLL exists but fails to load for another reason
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2026-05-16 21:55:33 +02:00
Fredia Huya-Kouadio 948032c89c [Android] Fix the use of --main-pack 2026-05-15 23:03:54 -07:00
Jan Haller dd29447f44 Warn when registering RefCounted as engine singleton
The `Engine::Singleton` struct stores a raw `Object *`, so registering
a `RefCounted` only works if some external `Ref<>` keeps it alive. This
pattern is fragile and can lead to UB, especially with GDExtension.
2026-05-15 11:00:16 +02:00
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