From e07784919fb8513dbbea3ce9d9b292f53df4c1b3 Mon Sep 17 00:00:00 2001 From: DataM0del <183248792+DataM0del@users.noreply.github.com> Date: Sun, 22 Dec 2024 15:56:03 -0600 Subject: [PATCH] fix(TestModule): unsubscribe from Render events on disable --- .../kotlin/info/opensigma/module/impl/misc/TestModule.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/info/opensigma/module/impl/misc/TestModule.kt b/src/main/kotlin/info/opensigma/module/impl/misc/TestModule.kt index 1843ef0..2894ee0 100644 --- a/src/main/kotlin/info/opensigma/module/impl/misc/TestModule.kt +++ b/src/main/kotlin/info/opensigma/module/impl/misc/TestModule.kt @@ -1,5 +1,6 @@ package info.opensigma.module.impl.misc +import info.opensigma.OpenSigma import info.opensigma.event.impl.render.Render2DEvent import info.opensigma.module.Module import info.opensigma.setting.impl.primitive.PrimitiveSetting @@ -21,6 +22,11 @@ class TestModule : Module("Test", "A module purely for testing purposes",GLFW.GL } } + override fun onDisable() { + super.onDisable() + OpenSigma.instance.eventBus.unsubscribe(this::on2D) + } + @EventHandler fun on2D(event: Render2DEvent) { jelloLight.drawString("Hello, world!", 5, 5, -1)