Skip to content

Commit

Permalink
fix(TestModule): unsubscribe from Render events on disable
Browse files Browse the repository at this point in the history
  • Loading branch information
DataM0del committed Dec 22, 2024
1 parent 7d981a0 commit e077849
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/info/opensigma/module/impl/misc/TestModule.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down

0 comments on commit e077849

Please sign in to comment.