https://kotlinlang.org logo
#coroutines
Title
# coroutines
b

bj0

01/22/2018, 11:51 PM
the error isn't always the same, but it's always on the same call to
actor
e

elizarov

01/23/2018, 7:59 AM
Any clue under what conditions it reproduces?
b

bj0

01/23/2018, 4:48 PM
not really, it's always the same place,
onCreateView
in a
Fragment
calls this extension:
Copy code
inline fun <T : View> T.onClick(disableDuring: Boolean = false, noinline action: suspend T.() -> Unit) {
    val actor = actor<Unit>(UI) {
        for (event in channel) {
            try {
                if (disableDuring) isEnabled = false
                action()
            } finally {
                if (disableDuring) isEnabled = true
            }
        }
    }

    setOnClickListener { actor.offer(Unit) }
}
the call to
actor
throws, and sometimes it's the arity error, sometimes it's a 'calling method on null object' error. I had copied several of them but deleted them. Whenever it happens I just gradle clean and rebuild (sometimes have to do it twice) and it works again
e

elizarov

01/23/2018, 5:12 PM
It is definitely a bug in incremental compilation somewhere. It would be extremely helpful if you find what changes reproduce it.
b

bj0

01/23/2018, 5:26 PM
not sure how to tell, the project is pretty big and it seemed to happen everytime I recompiled yesturday
3 Views