Skip to content

Commit

Permalink
Merge pull request #703 from skydoves/fix/window-token
Browse files Browse the repository at this point in the history
Check if the anchor view's window token is valid
  • Loading branch information
skydoves committed Sep 17, 2024
2 parents bfed2cd + def4c23 commit cc7b05e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions balloon/src/main/kotlin/com/skydoves/balloon/Balloon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,11 @@ public class Balloon private constructor(
// Sometimes there is a concurrency issue between show and dismiss the popupWindow. (#149)
if (bodyWindow.contentView.parent != null) return false

// we should check the anchor view is attached to the parent's window.
return ViewCompat.isAttachedToWindow(anchor)
// We should check if the anchor view's window token is valid.
if (!anchor.windowToken.isBinderAlive) return false

// We should check the anchor view is attached to the parent's window.
return anchor.isAttachedToWindow
}

private fun showOverlayWindow(anchor: View, subAnchors: List<View>) {
Expand Down

0 comments on commit cc7b05e

Please sign in to comment.