Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Cherry-picks related to ResourceLoader #96606

Open
wants to merge 17 commits into
base: 4.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
1c4849b
ResourceLoader: Revert workaround resource loading crashes due to bug…
RandomShaper Jun 19, 2024
257dd2f
Fix use condition_variable after free
Ratio2 Jul 29, 2024
ece3925
ResourceLoader: Properly push & pop TLS state on recursive load tasks
RandomShaper Jul 10, 2024
ea28ac5
ResourceLoader: Enhance deadlock prevention
RandomShaper Jul 10, 2024
8a78f5c
ResourceLoader: Optimize remap check by deferring until a non-mutex zone
RandomShaper Jul 10, 2024
b3e46a9
ResourceLoader: Fix edge cases in the management of user tokens
RandomShaper Jul 15, 2024
c75c50e
WorkerThreadPool (plus friends): Overhaul unlock allowance zones
RandomShaper Jul 18, 2024
fe2e862
ResourceLoader: Use better error handling for possible engine bugs
RandomShaper Aug 13, 2024
1fd87e8
Change warning muting so it affects all levels, but locally
RandomShaper Aug 26, 2024
98e7711
ResourceLoader: Handle another case of user tokens
RandomShaper Aug 28, 2024
f2d0f66
Fix ResourceLoader is not verbosely printing a resource path on loading
gongpha Jul 29, 2024
cd32705
ResourceLoader: Simplify handling of unregistered tasks
RandomShaper Sep 5, 2024
f806cfb
ResourceLoader: Add thread-aware resource changed mechanism
RandomShaper Sep 5, 2024
ea651a1
ResourceLoader: Add last resort life-time insurance for tokens
RandomShaper Sep 5, 2024
251237d
ResourceLoader: Fixup resource changed feature
RandomShaper Sep 6, 2024
9ed06bc
EditorResourcePreview: Let loads complete after exit requested
RandomShaper Sep 13, 2024
2444204
ResourceLoader: Report error if resource type unrecognized
RandomShaper Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions core/io/resource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
#include <stdio.h>

void Resource::emit_changed() {
if (ResourceLoader::is_within_load() && MessageQueue::get_main_singleton() != MessageQueue::get_singleton() && !MessageQueue::get_singleton()->is_flushing()) {
// Let the connection happen on the call queue, later, since signals are not thread-safe.
call_deferred("emit_signal", CoreStringName(changed));
} else {
emit_signal(CoreStringName(changed));
if (ResourceLoader::is_within_load() && !Thread::is_main_thread()) {
ResourceLoader::resource_changed_emit(this);
return;
}

emit_signal(CoreStringName(changed));
}

void Resource::_resource_path_changed() {
Expand Down Expand Up @@ -166,22 +166,22 @@ bool Resource::editor_can_reload_from_file() {
}

void Resource::connect_changed(const Callable &p_callable, uint32_t p_flags) {
if (ResourceLoader::is_within_load() && MessageQueue::get_main_singleton() != MessageQueue::get_singleton() && !MessageQueue::get_singleton()->is_flushing()) {
// Let the check and connection happen on the call queue, later, since signals are not thread-safe.
callable_mp(this, &Resource::connect_changed).call_deferred(p_callable, p_flags);
if (ResourceLoader::is_within_load() && !Thread::is_main_thread()) {
ResourceLoader::resource_changed_connect(this, p_callable, p_flags);
return;
}

if (!is_connected(CoreStringName(changed), p_callable) || p_flags & CONNECT_REFERENCE_COUNTED) {
connect(CoreStringName(changed), p_callable, p_flags);
}
}

void Resource::disconnect_changed(const Callable &p_callable) {
if (ResourceLoader::is_within_load() && MessageQueue::get_main_singleton() != MessageQueue::get_singleton() && !MessageQueue::get_singleton()->is_flushing()) {
// Let the check and disconnection happen on the call queue, later, since signals are not thread-safe.
callable_mp(this, &Resource::disconnect_changed).call_deferred(p_callable);
if (ResourceLoader::is_within_load() && !Thread::is_main_thread()) {
ResourceLoader::resource_changed_disconnect(this, p_callable);
return;
}

if (is_connected(CoreStringName(changed), p_callable)) {
disconnect(CoreStringName(changed), p_callable);
}
Expand Down
Loading
Loading