Skip to content

Commit 1241fa6

Browse files
committed
Fix context leaking this
1 parent ffa677a commit 1241fa6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

common/src/main/kotlin/com/lambda/config/Configuration.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ abstract class Configuration : Jsonable {
4343

4444
unsafeListener<ClientEvent.Shutdown>(Int.MIN_VALUE) { trySave() }
4545

46-
configurations.add(this)
46+
register()
4747
}
4848

49+
// Avoid context-leaking warning
50+
private fun register() = configurations.add(this)
51+
4952
override fun toJson() =
5053
JsonObject().apply {
5154
configurables.forEach {
@@ -99,8 +102,7 @@ abstract class Configuration : Jsonable {
99102
this@Configuration.info(message)
100103
}
101104
.onFailure {
102-
val message =
103-
"Failed to load ${configName.capitalize()} config from backup, unrecoverable error"
105+
val message = "Failed to load ${configName.capitalize()} config from backup, unrecoverable error"
104106
LOG.error(message, it)
105107
this@Configuration.logError(message)
106108
}

0 commit comments

Comments
 (0)