Skip to content

[Android] Crash on changing Tint of Searchbar #33070

@tritter

Description

@tritter

Description

App crashes because of changing a shared Drawable on the fly. I found out it is the SearchBar. It only happens on Android and in large apps with lots of screens. Unfortunately I can't reproduce it in the TestSuite. But by reading the docs of Android this crash is common and caused by changing a Drawable which is still referenced. With a custom SearchBarHandler the issues can be resolved.

It seems that it worked before net-9.0 but because it is hard to reproduce it's not 100% regression.

Steps to Reproduce

  1. Create multiple pages with a SearchBar
  2. Change Light/Dark mode
  3. Crash of complete app with native stack trace.

Link to public reproduction project repository

No response

Version with bug

10.0.20

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.10 SR1

Affected platforms

Android

Affected platform versions

Android 16

Did you find any workaround?

Yes I will link the PR!

Relevant log output

Backtrace (top frames):
  #00 pc 00000000006b8694  /system/lib64/libhwui.so
      android::getRootAlpha(_JNIEnv*, _jobject*, long) +4
  #01 pc 0000000002256c90  /memfd:jit-cache (deleted)
      art_jni_trampoline +112
  #02 pc 000000000223bc4c  /memfd:jit-cache (deleted)
      android.graphics.drawable.VectorDrawable.-$$Nest$smnGetRootAlpha +108
  #03 pc 000000000223bb20  /memfd:jit-cache (deleted)
      android.graphics.drawable.VectorDrawable$VectorDrawableState.getAlpha +144
  #04 pc 00000000025c50e0  /memfd:jit-cache (deleted)
      android.graphics.drawable.VectorDrawable.getAlpha +128
  #05 pc 00000000025c4f9c  /memfd:jit-cache (deleted)
      android.graphics.drawable.VectorDrawable.getOpacity +124
  #06 pc 00000000025c1ea8  /memfd:jit-cache (deleted)
      android.widget.ImageView.isOpaque +152
  #07 pc 000000000227979c  /memfd:jit-cache (deleted)
      android.view.View.invalidateInternal +428
  #08 pc 00000000025c4790  /memfd:jit-cache (deleted)
      android.widget.ImageView.invalidateDrawable +256
  #09 pc 000000000224419c  /memfd:jit-cache (deleted)
      android.graphics.drawable.Drawable.invalidateSelf +156
  #10 pc 000000000260e710  /memfd:jit-cache (deleted)
      android.graphics.drawable.VectorDrawable.setTintList +192
  #11 pc 00000000025d0094  /memfd:jit-cache (deleted)
      android.graphics.drawable.Drawable.setTint +148

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions