I'm trying to update to alpha05 and leakcanary is ...
# compose
w
I'm trying to update to alpha05 and leakcanary is reporting that the ClipboardManager is consistently leaking in any fragment that includes Compose. I'll include the full trace in the thread, for further investigation. I doubt this is something on our end, given that after the update we simply fixed what was explicitly broken. Any hints or is this a known bug?
Copy code
┬───
│ GC Root: Global variable in native code
│
├─ android.content.ClipboardManager$1 instance
│    Leaking: UNKNOWN
│    Anonymous subclass of android.content.IOnPrimaryClipChangedListener$Stub
│    ↓ ClipboardManager$1.this$0
│                         ~~~~~~
├─ android.content.ClipboardManager instance
│    Leaking: UNKNOWN
│    ↓ ClipboardManager.mPrimaryClipChangedListeners
│                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
├─ java.util.ArrayList instance
│    Leaking: UNKNOWN
│    ↓ ArrayList.elementData
│                ~~~~~~~~~~~
├─ java.lang.Object[] array
│    Leaking: UNKNOWN
│    ↓ Object[].[0]
│               ~~~
├─ androidx.compose.ui.platform.AndroidClipboardManagerKt$sam$android_content_ClipboardManager_OnPrimaryClipChangedListener$0 instance
│    Leaking: UNKNOWN
│    Anonymous class implementing android.content.ClipboardManager$OnPrimaryClipChangedListener
│    ↓ AndroidClipboardManagerKt$sam$android_content_ClipboardManager_OnPrimaryClipChangedListener$0.function
│                                                                                                    ~~~~~~~~
├─ androidx.compose.ui.platform.AndroidComposeView$1 instance
│    Leaking: UNKNOWN
│    Anonymous subclass of kotlin.jvm.internal.Lambda
│    ↓ AndroidComposeView$1.$this
│                           ~~~~~
├─ androidx.compose.ui.platform.AndroidComposeView instance
│    Leaking: YES (View detached and has parent)
│    mContext instance of dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper, wrapping activity com.toggl.ui.MainActivity with mDestroyed = false
│    View#mParent is set
│    View#mAttachInfo is null (view detached)
│    View.mWindowAttachCount = 1
│    ↓ AndroidComposeView.mParent
╰→ android.widget.LinearLayout instance
     Leaking: YES (ObjectWatcher was watching this because com.toggl.reports.ui.ReportsFragment received Fragment#onDestroyView() callback (references to its views should be cleared to prevent leaks))
     key = 739367d2-9da5-437f-9417-50fc7237b539
     watchDurationMillis = 15990
     retainedDurationMillis = 10988
     mContext instance of dagger.hilt.android.internal.managers.ViewComponentManager$FragmentContextWrapper, wrapping activity com.toggl.ui.MainActivity with mDestroyed = false
     View#mParent is null
     View#mAttachInfo is null (view detached)
     View.mWindowAttachCount = 1

METADATA

Build.VERSION.SDK_INT: 30
Build.MANUFACTURER: Google
LeakCanary version: 2.4
App process name: com.toggl.aurora.debug
Analysis duration: 8814 ms
a
I think it was fixed in https://android-review.googlesource.com/c/platform/frameworks/support/+/1460743 and should be released in alpha06
🎉 5