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

Fix GDExtension classes inheriting from Resource not using icons in FileSystem #97421

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

SaNeOr
Copy link
Contributor

@SaNeOr SaNeOr commented Sep 24, 2024

fix #97387

@fire fire changed the title fix GDExtension classes inheriting from Resource are not using icons … Fix GDExtension classes inheriting from Resource are not using icons … Sep 24, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Sep 25, 2024
@AThousandShips AThousandShips changed the title Fix GDExtension classes inheriting from Resource are not using icons … Fix GDExtension classes inheriting from Resource not using icons in FileSystem Sep 25, 2024
@AThousandShips AThousandShips requested a review from a team September 25, 2024 08:50
Copy link
Contributor

@Hilderin Hilderin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! Tested with the MRP on master and with this PR and it fixes the issue as expected.

@akien-mga akien-mga merged commit 841061d into godotengine:master Sep 26, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

@akien-mga
Copy link
Member

This seems to cause a crash in one of my test projects:

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.4.dev.custom_build (ac1ef5c9f64f1c21f9addfc98be460e08dff8fb7)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /lib64/libc.so.6(+0x40d00) [0x7efce506ad00] (??:0)
[2] CowData<char32_t>::_ref(CowData<char32_t> const&) (/home/akien/Godot/godot/./core/templates/cowdata.h:461)
[3] String::String(String const&) (/home/akien/Godot/godot/./core/string/ustring.h:483)
[4] Resource::get_path() const (/home/akien/Godot/godot/./core/io/resource.cpp:95)
[5] EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInfo*) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1981 (discriminator 6))
[6] EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory*) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1995 (discriminator 3))
[7] EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory*) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1992 (discriminator 3))
[8] EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory*) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1992 (discriminator 3))
[9] EditorFileSystem::_update_files_icon_path(EditorFileSystemDirectory*) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1992 (discriminator 3))
[10] EditorFileSystem::_notification(int) (/home/akien/Godot/godot/./editor/editor_file_system.cpp:1672)
[11] EditorFileSystem::_notificationv(int, bool) (/home/akien/Godot/godot/./editor/editor_file_system.h:145 (discriminator 14))
[12] Object::notification(int, bool) (/home/akien/Godot/godot/./core/object/object.cpp:878)
[13] SceneTree::_process_group(SceneTree::ProcessGroup*, bool) (/home/akien/Godot/godot/./scene/main/scene_tree.cpp:1020)
[14] SceneTree::_process(bool) (/home/akien/Godot/godot/./scene/main/scene_tree.cpp:1092 (discriminator 2))
[15] SceneTree::process(double) (/home/akien/Godot/godot/./scene/main/scene_tree.cpp:582)
[16] Main::iteration() (/home/akien/Godot/godot/main/main.cpp:4383 (discriminator 3))
[17] OS_LinuxBSD::run() (/home/akien/Godot/godot/platform/linuxbsd/os_linuxbsd.cpp:962 (discriminator 1))
[18] /home/akien/Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64(main+0x14b) [0x6098af1] (/home/akien/Godot/godot/platform/linuxbsd/godot_linuxbsd.cpp:85)
[19] /lib64/libc.so.6(+0x2a088) [0x7efce5054088] (??:0)
[20] /lib64/libc.so.6(__libc_start_main+0x8b) [0x7efce505414b] (??:0)
[21] /home/akien/Godot/godot/bin/godot.linuxbsd.editor.dev.x86_64(_start+0x25) [0x60988e5] (??:?)
-- END OF BACKTRACE --
================================================================

Trying to figure out why and make a MRP.

@akien-mga
Copy link
Member

akien-mga commented Sep 26, 2024

It's crashing for me when there's an .icns icon in the project:
new-test-project.zip

Edit: #97491 should fix it.

@@ -1872,6 +1872,10 @@ void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInf
}
}

if (icon_path.is_empty() && !file_info->type.is_empty()) {
icon_path = EditorNode::get_singleton()->get_class_icon(file_info->type)->get_path();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrongly assuming that the result of EditorNode::get_singleton()->get_class_icon(file_info->type) is valid and can de-referenced.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by #97491.

akien-mga added a commit to akien-mga/godot that referenced this pull request Sep 26, 2024
laurentmackay pushed a commit to metapfhor/godot that referenced this pull request Oct 30, 2024
JayTropper pushed a commit to JayTropper/godot that referenced this pull request Nov 6, 2024
jss2a98aj pushed a commit to jss2a98aj/blazium that referenced this pull request Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GDExtension classes inheriting from Resource are not using icons in FileSystem
4 participants