@@ -474,7 +474,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
474
474
* to check for an exception, but that logic would need to manually handle the final state, which is
475
475
* less straightforward.
476
476
*/
477
- val rootCause = (state as ? Finishing )?.let { synchronized(it) { it. rootCause } }
477
+ val rootCause = (state as ? Finishing )?.rootCause
478
478
if (rootCause == null ) {
479
479
/* *
480
480
* There is no known root cause yet, so we can add the node to the list of state handlers.
@@ -916,7 +916,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
916
916
// atomically transition to finishing & completing state
917
917
val finishing = state as ? Finishing ? : Finishing (list, false , null )
918
918
// must synchronize updates to finishing state
919
- var notifyRootCause: Throwable ? = null
919
+ val notifyRootCause: Throwable ?
920
920
synchronized(finishing) {
921
921
// check if this state is already completing
922
922
if (finishing.isCompleting) return COMPLETING_ALREADY
@@ -1045,7 +1045,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
1045
1045
val rootCause = when (val latestState = this .state) {
1046
1046
is Finishing -> {
1047
1047
// The state is still incomplete, so we need to notify the child about the completion cause.
1048
- synchronized( latestState) { latestState .rootCause }
1048
+ latestState.rootCause
1049
1049
}
1050
1050
else -> {
1051
1051
/* * Since the list is already closed for [onCancelling], the job is either Finishing or
0 commit comments