compose-multiplatform-file-picker icon indicating copy to clipboard operation
compose-multiplatform-file-picker copied to clipboard

Clashes with LWJGL on Linux

Open wyskoj opened this issue 2 years ago • 3 comments

I have a very specific problem and may be related to #30? I'm unfortunately not very knowledgeable about how the JVM interacts with native system calls, so this is a little out of my league.

My application requires LWJGL to operate. I have a Compose application that launches a jMonkeyEngine application—this is dependent on LWJGL. When LWJGL2 is on the classpath, attempts to open the file picker open an old, legacy file chooser:

image

This is also printed to the console: A call to chooseDirectoryNative failed: 'org.lwjgl.system.CustomBuffer org.lwjgl.PointerBuffer.rewind()'


If I instead package LWJGL3, the true, native picker is opened:

image

However, the JVM will sometimes crash when selecting a file. (Seemingly randomly, it happens maybe half the time?) When it crashes the JVM does a memory dump, so I've attached that here.


I package LWJGL by adding either of these dependencies to my Gradle build script: implementation("org.jmonkeyengine:jme3-lwjgl:3.5.2-stable") or implementation("org.jmonkeyengine:jme3-lwjgl3:3.5.2-stable").


Therefore, I expect the file picker to load the native file picker (as seen in the second screenshot) without crashing. But—depending on the LWJGL version on the classpath—it either loads a legacy file picker, or randomly crashes.

If there's any other information I can provide, let me know.

wyskoj avatar Aug 18 '23 13:08 wyskoj

thanks for the detailed report! Which version was this, the recently released 2.0.2?

Wavesonics avatar Aug 18 '23 17:08 Wavesonics

My application is based on Java 11 so I can't currently upgrade to 2.0.2, currently at 1.2.0.

I'm not opposed to migrating my application to 17 (in fact I probably should) so I'll see if I can get that migrated and see if the issue persists.

wyskoj avatar Aug 18 '23 20:08 wyskoj

On Java 17 now and version 2.0.2. Having LWJGL3 on the classpath produces no problems (at least, I can't get it to crash). LWJGL2 still produces the legacy file picker and a new message is printed to console. First launch of file picker: A call to chooseDirectoryNative failed: null and subsequent calls: A call to chooseDirectoryNative failed: Could not initialize class org.lwjgl.system.MemoryStack.

So my personal issue is resolved... don't know if this LWJGL2 issue is something you want to pursue or not...

wyskoj avatar Aug 19 '23 01:08 wyskoj