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

Register types to fix casting #27

Merged
merged 5 commits into from
Dec 31, 2022
Merged

Register types to fix casting #27

merged 5 commits into from
Dec 31, 2022

Conversation

jwharm
Copy link
Owner

@jwharm jwharm commented Dec 31, 2022

This will fix #18

@jwharm jwharm merged commit 1b61621 into main Dec 31, 2022
@jwharm jwharm deleted the types-registered branch December 31, 2022 13:56
@JFronny
Copy link
Contributor

JFronny commented Jan 2, 2023

This causes a regression with cross-platform compatibility, since a non-existing type will now cause a NPE while type registration is ongoing (EG Cannot invoke "java.lang.invoke.MethodHandle.invokeExact()" because "org.gtk.gio.DesktopAppInfo$DowncallHandles.g_desktop_app_info_get_type" is null on Windows)

@jwharm
Copy link
Owner Author

jwharm commented Jan 2, 2023

I will add a try/catch around each getType call to suppress the NPE. (somewhere later this week probably)

If you generate GIR files on Windows from a GTK build folder, those files should only contain valid types for the platform. Or use the repository mentioned by badcel in #16.

@JFronny
Copy link
Contributor

JFronny commented Jan 2, 2023

I'm currently hacking together a workaround by inserting a null check, which seems to work.

JFronny added a commit that referenced this pull request Jan 2, 2023
@JFronny JFronny mentioned this pull request Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace castFrom() with regular cast
2 participants