Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Leak canary app crashes if you click on the 3 dots to delete heap dumps while on the heap dumps tab. #2294

Closed
joerogers opened this issue Jan 21, 2022 · 2 comments · Fixed by #2327

Comments

@joerogers
Copy link

joerogers commented Jan 21, 2022

Description

Fatal Exception: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter p1
       at leakcanary.AndroidLeakFixes$Companion$WindowDelegateCallback.onMenuOpened(AndroidLeakFixes.kt)
       at com.android.internal.policy.PhoneWindow$ActionMenuPresenterCallback.onOpenSubMenu(PhoneWindow.java:2180)
       at com.android.internal.view.menu.BaseMenuPresenter.onSubMenuSelected(BaseMenuPresenter.java:209)
       at android.widget.ActionMenuPresenter.showOverflowMenu(ActionMenuPresenter.java:544)
       at android.widget.ActionMenuPresenter$OverflowMenuButton.performClick(ActionMenuPresenter.java:867)
       at android.view.View$PerformClick.run(View.java:21153)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Steps to Reproduce

Run on Android 6.0 (emulator in theory should be fine although I ran on a Nexus 5 i use for min sdk testing)

  1. Create a simple app and do something that triggers a heap dump
  2. Open the leak canary app on
  3. Click on the 3 dots to attempt to delete the heap dump

App crashes with the above stack.

Expected behavior:

Given the option to delete all dumps and clicking it deletes the dumps

Version Information

  • LeakCanary version: 2.8.1
  • Android OS version: 6.0 (but might occur on other versions before 10)
  • Gradle version: 7.3.2

Additional Information

None

@tatocaster
Copy link
Contributor

This problem is reproducible on LeakCanary 2.8.1

I've played with the source and appears that the problem is on AndroidLeakFixes.kt:796

      val newCallback = WindowDelegateCallback(currentCallback)
      callback = newCallback  <--- here
      newCallback

What do you think @pyricau?

@pyricau
Copy link
Member

pyricau commented Apr 2, 2022

Thx! This is a known issue: https://issuetracker.google.com/issues/188568911

Unfortunately Kotlin generated delegates add null checks for @NonNull annotations, so the only work around is to fallback to manual: https://github.com/square/curtains/blob/d1d98a0bb9fb70e7ff820347372b5d914067b1a9/curtains/src/main/java/curtains/internal/FixedWindowCallback.java#L25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants