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

Incompatibility with multiple mods on macOS due to use of AWT classes #78

Open
magneticflux- opened this issue Sep 5, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@magneticflux-
Copy link
Owner

The existing system needs to be expanded to include all mods on macOS.

See #31, #41

@magneticflux- magneticflux- added the bug Something isn't working label Sep 5, 2021
@magneticflux- magneticflux- self-assigned this Sep 5, 2021
@Mask
Copy link

Mask commented Sep 17, 2021

Note that (as in described in the comments of #31) the current implementation crashes/hangs on MacOS without any other mods - so it's not only a matter of interaction with other AWT-using mods

@magneticflux-
Copy link
Owner Author

@Mask Can you reproduce the crash in a development environment with a breakpoint placed on java.awt.Toolkit.loadLibraries() and show the stacktrace? I'd like to figure out which class is triggering the load.

The culprit I identified in Optifine are documented here: sp614x/optifine#4980

Additionally, 80da320 should work around any more of these issues with other mods going forward. I plan to release this last patch for 1.17.x and then start on 1.18.

@Mask
Copy link

Mask commented Dec 17, 2021

@magneticflux- using 48165f4
I put a breakpoint on java.awt.Toolkit.loadLibraries() but it is never executed.
If I put a breakpoint on

private fun ensureNotHeadless() {
if (GraphicsEnvironment.isHeadless()) {
LOG.warn("Unable to unset headless earlier (are you using macOS?), doing it with nasty reflection now!")
val headlessField = GraphicsEnvironment::class.java.getDeclaredField("headless")
headlessField.isAccessible = true
headlessField[null] = false
}
}
then I see an exception being thrown on headlessField.isAccessible = true:

Unable to make field private static java.lang.Boolean java.awt.GraphicsEnvironment.headless accessible: module java.desktop does not "opens java.awt" to unnamed module @7ffa6333

	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
	at java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[?:?]
	at java.lang.reflect.Field.setAccessible(Field.java:172) ~[?:?]
	at com.skaggsm.mumblelinkmod.client.ClientMumbleLinkMod.ensureNotHeadless(ClientMumbleLinkMod.kt:198) ~[main/:?]
	at com.skaggsm.mumblelinkmod.client.ClientMumbleLinkMod.channelHandler(ClientMumbleLinkMod.kt:72) ~[main/:?]
	at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:97) ~[fabric-networking-api-v1-1.0.18+3ac43d95c8.jar:?]
	at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.receive(ClientPlayNetworkAddon.java:39) ~[fabric-networking-api-v1-1.0.18+3ac43d95c8.jar:?]
	at net.fabricmc.fabric.impl.networking.AbstractChanneledNetworkAddon.handle(AbstractChanneledNetworkAddon.java:100) [fabric-networking-api-v1-1.0.18+3ac43d95c8.jar:?]
	at net.fabricmc.fabric.impl.networking.client.ClientPlayNetworkAddon.handle(ClientPlayNetworkAddon.java:89) [fabric-networking-api-v1-1.0.18+3ac43d95c8.jar:?]
	at net.minecraft.client.network.ClientPlayNetworkHandler.handler$zzo000$handleCustomPayload(ClientPlayNetworkHandler.java:2238) [[email protected]:?]

@magneticflux-
Copy link
Owner Author

Ah, whoops, that would do it. I'll avoid reflection and just special-case macOS then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants