@@ -476,7 +476,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
476
476
* to check for an exception, but that logic would need to manually handle the final state, which is
477
477
* less straightforward.
478
478
*/
479
- val rootCause = (state as ? Finishing )?.let { synchronized(it) { it. rootCause } }
479
+ val rootCause = (state as ? Finishing )?.rootCause
480
480
if (rootCause == null ) {
481
481
/* *
482
482
* There is no known root cause yet, so we can add the node to the list of state handlers.
@@ -906,7 +906,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
906
906
// atomically transition to finishing & completing state
907
907
val finishing = state as ? Finishing ? : Finishing (list, false , null )
908
908
// must synchronize updates to finishing state
909
- var notifyRootCause: Throwable ? = null
909
+ val notifyRootCause: Throwable ?
910
910
synchronized(finishing) {
911
911
// check if this state is already completing
912
912
if (finishing.isCompleting) return COMPLETING_ALREADY
@@ -1035,7 +1035,7 @@ public open class JobSupport constructor(active: Boolean) : Job, ChildJob, Paren
1035
1035
val rootCause = when (val latestState = this .state) {
1036
1036
is Finishing -> {
1037
1037
// The state is still incomplete, so we need to notify the child about the completion cause.
1038
- synchronized( latestState) { latestState .rootCause }
1038
+ latestState.rootCause
1039
1039
}
1040
1040
else -> {
1041
1041
/* * Since the list is already closed for [onCancelling], the job is either Finishing or
0 commit comments