Skip to content

Commit 483c84b

Browse files
ADFA-3418: Unregister the flashbar config callback when the bar detaches
The dismiss paths unregister from a post{} that never runs once the view is detached, so a flashbar still showing when its activity was destroyed left a ComponentCallbacks on the Application holding that activity. Reproduced by a dark-mode recreate under the indefinite 'Project initialization failed' bar (ADFA-5528).
1 parent 047c643 commit 483c84b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎subprojects/flashbar/src/main/java/com/itsaky/androidide/flashbar/FlashbarContainerView.kt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ internal class FlashbarContainerView(context: Context)
106106
return super.onInterceptTouchEvent(event)
107107
}
108108

109+
// The dismiss paths unregister from a post{}, which never runs once the view is detached, so a
110+
// bar still up when its activity is destroyed left the callback holding that activity.
111+
override fun onDetachedFromWindow() {
112+
super.onDetachedFromWindow()
113+
unregisterConfigurationCallback()
114+
}
115+
109116
override fun onSwipe(isSwiping: Boolean) {
110117
isBarDismissing = isSwiping
111118
if (isSwiping) {

0 commit comments

Comments
 (0)