-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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 reload of GDExtension libraries in framework package on macOS #95143
Fix reload of GDExtension libraries in framework package on macOS #95143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This looks good to me. I tested on Windows and it seems to be working just fine: creation and clean-up of the temporary copy looks good, and a quick test of reload worked fine. I also tested on Linux, just to ensure there wasn't any regression there.
It's probably too late to get this into Godot 4.3-stable, but this is something we should definitely cherry-pick for Godot 4.3.1-stable.
Thanks for making the change I suggested! However, you'll need to squash this down to one commit, per Godot's development workflow: https://docs.godotengine.org/en/latest/contributing/workflow/pr_workflow.html#the-interactive-rebase |
`GDExtension::open_library` has a check in it to see if the library was loaded from a temp file, and if it was to restore the original name as that is the one we actually care about. This check is breaking extension reloading on Mac when the library path is to a framework folder, as the file inside the framework will not generally be the same name as the folder. This check also shouldn't be necessary even on Windows, which is the only platform that uses `generate_temp_files`, since disposal of the created temp file is handled within `OS_Windows::open_dynamic_library`, and `GDExtension::open_library` (which is the only function to call `open_dynamic_library` with a `p_data` argument) only cares about the original library file path and has to do extra work to remove the name of the temp file. Instead, I have removed that check and set `OS_Windows::open_dynamic_library` to return the name of the original file and not the name of the copy. This fixes GDExtension reloading on macOS. I do not have a Windows machine available to test that it still works properly on Windows, so someone should check that before merging this.
2ffe454
to
f44d6a2
Compare
@dsnopek fixed now. |
Thanks! |
Thanks! And congrats for your first merged Godot contribution 🎉 |
Cherry-picked for 4.3.1. |
GDExtension::open_library
has a check in it to see if the library was loaded from a temp file, and if it was to restore the original name as that is the one we actually care about. This check is breaking extension reloading on Mac when the library path is to a framework folder, as the file inside the framework will not generally be the same name as the folder.This check also shouldn't be necessary even on Windows, which is the only platform that uses
generate_temp_files
, since disposal of the created temp file is handled withinOS_Windows::open_dynamic_library
, andGDExtension::open_library
(which is the only function to callopen_dynamic_library
with ap_data
argument) only cares about the original library file path and has to do extra work to remove the name of the temp file. Instead, I have removed that check and setOS_Windows::open_dynamic_library
to return the name of the original file and not the name of the copy.This fixes GDExtension reloading on macOS. I do not have a Windows machine available to test that it still works properly on Windows, so someone should check that before merging this.