You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.
The implementation looks wrong - the listener which is added to the onDockListeners is a lambda which wraps the original listener, but inside the lambda the code tries to remove the original listener (which quietly returns false).
The result - the listener gets called on each dock.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. I've committed a fix now. I wanted to find a way to avoid the intermediary wrapped variable, but was unable to find a smoother way than this:
fun <U:UIComponent> U.whenDockedOnce(listener: (U) ->Unit) {
if (onDockListeners ==null) onDockListeners =mutableListOf()
var wrapped: (U) ->Unit= {}
wrapped = {
runLater {
onDockListeners!!.remove(wrapped)
}
listener(it)
}
whenDocked(wrapped)
}
The runLater is needed to avoid removing the listener from the list as it is being iterated over.
/~https://github.com/edvin/tornadofx/blob/master/src/main/java/tornadofx/Component.kt#L1261
The implementation looks wrong - the listener which is added to the
onDockListeners
is a lambda which wraps the original listener, but inside the lambda the code tries to remove the original listener (which quietly returns false).The result - the listener gets called on each dock.
The text was updated successfully, but these errors were encountered: