LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.75k stars 635 forks source link

TinyFileDialogs.ntinyfd_selectFolderDialog freezes UI thread for 65 seconds #985

Closed ViugiNick closed 4 days ago

ViugiNick commented 4 months ago

Version

3.3.3

Platform

macOS arm64

JDK

OpenJDK 64-Bit Server VM 17.0.11

Module

TinyFileDialogs

Bug description

It is an Android Studio UI Freeze report, so unfortunately we don't have information on the plugin version used:

org.jetbrains.skiko.FrameDispatcher$job$1.invokeSuspend(FrameDispatcher.kt:33) [57100ms]
org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) [57100ms]
org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invoke(MetalRedrawer.kt) [57100ms]
org.jetbrains.skiko.redrawer.MetalRedrawer$frameDispatcher$1.invokeSuspend(MetalRedrawer.kt:82) [57100ms]
org.jetbrains.skiko.redrawer.AWTRedrawer.update(AWTRedrawer.kt:54) [57100ms]
org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.awt.kt:548) [57100ms]
androidx.compose.ui.scene.ComposeSceneMediator$DesktopSkikoView.onRender(ComposeSceneMediator.desktop.kt:566) [57100ms]
androidx.compose.ui.scene.BaseComposeScene.render(BaseComposeScene.skiko.kt:167) [57100ms]
androidx.compose.ui.scene.ComposeSceneRecomposer.performScheduledEffects(ComposeSceneRecomposer.skiko.kt:89) [57100ms]
androidx.compose.ui.platform.FlushCoroutineDispatcher.flush(FlushCoroutineDispatcher.skiko.kt:78) [57100ms]
androidx.compose.ui.platform.FlushCoroutineDispatcher.performRun(FlushCoroutineDispatcher.skiko.kt:99) [57100ms]
androidx.compose.ui.platform.FlushCoroutineDispatcher$flush$1.invoke(FlushCoroutineDispatcher.skiko.kt:78) [57100ms]
androidx.compose.ui.platform.FlushCoroutineDispatcher$flush$1.invoke(FlushCoroutineDispatcher.skiko.kt:90) [57100ms]
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) [57100ms]
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [57100ms]
com.darkrockstudios.libraries.mpfilepicker.DesktopFilePickerKt$DirectoryPicker$1$1.invokeSuspend(DesktopFilePicker.kt:88) [57100ms]
com.darkrockstudios.libraries.mpfilepicker.FileChooserKt.chooseDirectory(FileChooser.kt:51) [57100ms]
org.lwjgl.util.tinyfd.TinyFileDialogs.tinyfd_selectFolderDialog(TinyFileDialogs.java:523) [57100ms]
org.lwjgl.util.tinyfd.TinyFileDialogs.ntinyfd_selectFolderDialog(Native Method) [57100ms]

Stacktrace or crash log output

No response

octylFractal commented 4 months ago

If the user takes 65 seconds to respond to the dialog this is expected. The function must block until the user selects a folder, or it could not return it. I'm semi-confident that you can call this on any thread, so it should just not be called on the UI thread if you don't want to block it.

Spasi commented 4 days ago

Hey @ViugiNick,

It looks like some interaction between AWT and tinyfd. They are not compatible and should not be used together.