Open paul opened 1 year ago
Same issue, with stl-thumb 0.5.0
and stl-thumb-kde 0.4.0
built from source on Fedora 38:
thread '<unnamed>' panicked at 'Creating EventLoop multiple times is not supported.', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.27.3/src/event_loop.rs:106:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'Creating EventLoop multiple times is not supported.', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.27.3/src/event_loop.rs:106:13
com.stl-thumb-kde: STL-THUMB :: lib returned error
Sometimes when re-entering a directory I get a single additional thumbnail before stl-thumb
panics.
I have noticed similar issues too, but not had chance to look into the cause of the issue. Its something I will be investigating over the holiday
Base OS: Fedora Kinoite 39 Window Manager: Wayland Desktop: KDE
So from what I can tell some of those errors are coming from stl-thumb, but also don't look to be terminal, but could be causing some of the issues of "Running multiple times" as parts are "still attached"
From what I remember looking into this, the core issue is the following: Dolphin will load stl-thumb-kde
into memory once on startup and then call render_to_buffer
for every file. render_to_buffer
calls render_to_image
in a separate thread, which then calls create_headless_display
. However, there was a global static OnceCell
in place, which prevented creating multiple contexts, even across threads, without unloading and reloading the application, resulting in https://github.com/unlimitedbacon/stl-thumb-kde/issues/5#issuecomment-1656252503. However, it seems like stuff has changed a lot over in glutin/glium
land. The currently used version in stl-thumb
still has the check in place. Similarly, for the latest glium
, one needs to use winit
directly for creating the event loop, and the check is still there, however, it is a bit more graceful now.
Ultimately, the correct solution would be to initialize the event loop and graphics context exactly once as the application is initialized, and not for every thumbnail rendering invocation. As a bonus, this should also be faster, since rendering a single thumbnail will not require a full context initialization. Hopefully this helps in the debugging quest!
When I open Dolphin in a folder full of .stl files, a few render thumbnails, but most do not.
If I watch the log when I open the folder, it gets filled with error messages like this:
This is using
plasmashell 5.27.5
on Fedora 38. It also reports the same error in a folder with only a single .stl file in it.Not sure if its relevant, I commented out some stuff in create_headless_display and replaced it with
context = cb.build_osmesa(size)?;
and it logged this the first time, then the same "Creating EventLoop multiple times" after that: