Skip to content

Commit

Permalink
fix: prevent computations after disposal of the engine
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Jul 19, 2024
1 parent 9645b18 commit e7d9cec
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class IncrementalEngine(val maxSize: Int = 100_000) : IIncrementalEngine, IState

fun getGraphSize() = graph.getSize()

fun isDisposed() = disposed

private fun checkDisposed() {
if (disposed) throw IllegalStateException("engine is disposed")
}
Expand Down Expand Up @@ -145,6 +147,7 @@ class IncrementalEngine(val maxSize: Int = 100_000) : IIncrementalEngine, IState
TODO("Not yet implemented")
}

@Synchronized
fun dispose() {
if (disposed) return
disposed = true
Expand Down

0 comments on commit e7d9cec

Please sign in to comment.