container: handle open/close events on rendering thread

Windows does not allow changing the gl cursor mode on non main thread (or at least it behaves undefined). Both events may be called from any thread (e.g. the network thread when opening a chest). Thread safety was not guaranteed anymore and thus breaking.

Fixes #118
This commit is contained in:
Moritz Zwerger 2023-11-24 23:01:19 +01:00
parent a63b020e53
commit ae7b15de10
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -72,7 +72,8 @@ object ContainerGUIManager {
registerLocalContainerEvent(guiRenderer) registerLocalContainerEvent(guiRenderer)
guiRenderer.connection.events.listen<ContainerOpenEvent> { open(guiRenderer, it.container) } val queue = guiRenderer.context.queue
guiRenderer.connection.events.listen<ContainerCloseEvent> { close(guiRenderer, it.container) } guiRenderer.connection.events.listen<ContainerOpenEvent> { queue += { open(guiRenderer, it.container) } }
guiRenderer.connection.events.listen<ContainerCloseEvent> { queue += { close(guiRenderer, it.container) } }
} }
} }