From 2c4f702d5029679db5343152cbab5b0a32577d79 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Thu, 23 Mar 2017 18:37:25 +0300 Subject: [PATCH] Remove stored contexts in tests to avoid leaks --- .../idea/debugger/KotlinDebuggerTestBase.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt index 17a4f85ee96..823ed579b5e 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt @@ -64,8 +64,11 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() { private var oldDisableKotlinInternalClasses = false private var oldRenderDelegatedProperties = false - protected lateinit var evaluationContext: EvaluationContextImpl - protected lateinit var debuggerContext: DebuggerContextImpl + protected var _evaluationContext: EvaluationContextImpl? = null + protected val evaluationContext get() = _evaluationContext!! + + protected var _debuggerContext: DebuggerContextImpl? = null + protected val debuggerContext get() = _debuggerContext!! override fun initApplication() { super.initApplication() @@ -74,7 +77,11 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() { override fun tearDown() { super.tearDown() + restoreDefaultSettings() + + _evaluationContext = null + _debuggerContext = null } protected fun configureSettings(fileText: String) { @@ -136,8 +143,8 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() { } protected fun initContexts(suspendContext: SuspendContextImpl) { - evaluationContext = createEvaluationContext(suspendContext) - debuggerContext = createDebuggerContext(suspendContext) + _evaluationContext = createEvaluationContext(suspendContext) + _debuggerContext = createDebuggerContext(suspendContext) } protected fun SuspendContextImpl.doStepInto(ignoreFilters: Boolean, smartStepFilter: MethodFilter?) {