From 96e7b7c6b3fd41d12e17f677f28074fae985df72 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Sun, 21 Feb 2021 14:01:37 -0700 Subject: [PATCH] Fix potential memory leak in ReviewHelper There was a static reference to the currentActivity that was unnecessary --- .../java/com/wbrawner/simplemarkdown/utility/ReviewHelper.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/src/play/java/com/wbrawner/simplemarkdown/utility/ReviewHelper.kt b/app/src/play/java/com/wbrawner/simplemarkdown/utility/ReviewHelper.kt index 3b515c5..3806c0a 100644 --- a/app/src/play/java/com/wbrawner/simplemarkdown/utility/ReviewHelper.kt +++ b/app/src/play/java/com/wbrawner/simplemarkdown/utility/ReviewHelper.kt @@ -27,8 +27,6 @@ object ReviewHelper : Application.ActivityLifecycleCallbacks { private lateinit var application: Application private lateinit var reviewManager: ReviewManager private lateinit var sharedPreferences: SharedPreferences - private val errorHandler: ErrorHandler by errorHandlerImpl() - private var currentActivity: Activity? = null private var activityCount = 0 set(value) { field = if (value < 0) { @@ -60,7 +58,6 @@ object ReviewHelper : Application.ActivityLifecycleCallbacks { } override fun onActivityStarted(activity: Activity) { - currentActivity = activity if (activityCount++ == 0) { activeTime = SystemClock.elapsedRealtime() } @@ -101,7 +98,6 @@ object ReviewHelper : Application.ActivityLifecycleCallbacks { } override fun onActivityStopped(activity: Activity) { - currentActivity = null if (--activityCount == 0) { sharedPreferences.edit { putLong(KEY_TIME_IN_APP, SystemClock.elapsedRealtime() - activeTime)