Skip to content

java.lang.StackOverflowError : disableLongPress (SingleRowCalendar.kt:234) #33

@kelalaka153

Description

@kelalaka153

We have a rare error like this;

Exception java.lang.StackOverflowError: stack size 8192KB
  at java.util.HashMap.putVal (HashMap.java:630)
  at java.util.HashMap.put (HashMap.java:611)
  at java.util.HashSet.add (HashSet.java:219)
  at androidx.recyclerview.selection.Selection.add (Selection.java:184)
  at androidx.recyclerview.selection.DefaultSelectionTracker.select (DefaultSelectionTracker.java:234)
  at com.michalsvec.singlerowcalendar.calendar.SingleRowCalendar.disableLongPress (SingleRowCalendar.kt:234)
  at com.michalsvec.singlerowcalendar.calendar.SingleRowCalendar.access$disableLongPress (SingleRowCalendar.kt:23)
  at com.michalsvec.singlerowcalendar.calendar.SingleRowCalendar$initSelection$selectionObserver$1.onItemStateChanged (SingleRowCalendar.kt:197)
  at com.michalsvec.singlerowcalendar.calendar.SingleRowCalendar$initSelection$selectionObserver$1.onItemStateChanged (SingleRowCalendar.kt:186)
  at androidx.recyclerview.selection.DefaultSelectionTracker.notifyItemStateChanged (DefaultSelectionTracker.java:445)
  at androidx.recyclerview.selection.DefaultSelectionTracker.notifySelectionCleared (DefaultSelectionTracker.java:457)
  at androidx.recyclerview.selection.DefaultSelectionTracker.clearPrimarySelection (DefaultSelectionTracker.java:182)
  at androidx.recyclerview.selection.DefaultSelectionTracker.clearSelection (DefaultSelectionTracker.java:170)

  at androidx.recyclerview.selection.DefaultSelectionTracker.reset (DefaultSelectionTracker.java:206)
  at androidx.recyclerview.selection.ResetManager.callResetHandlers (ResetManager.java:97)
  at androidx.recyclerview.selection.ResetManager$2.onSelectionCleared (ResetManager.java:75)
  at androidx.recyclerview.selection.DefaultSelectionTracker.notifySelectionCleared (DefaultSelectionTracker.java:451)
  at androidx.recyclerview.selection.DefaultSelectionTracker.clearSelection (DefaultSelectionTracker.java:171)
  at androidx.recyclerview.selection.DefaultSelectionTracker.reset (DefaultSelectionTracker.java:206)

THe last part repeats and I don't know how many times. This is from crush details from Google Play Console.

We cannot reproduce this error, though, rarely occurs during many versions..

This is the XML

  <com.michalsvec.singlerowcalendar.calendar.SingleRowCalendar
      android:id="@+id/main_single_row_calendar"
      android:layout_width="match_parent"
      android:layout_height="0dp"
      android:layout_marginHorizontal="8dp"
      android:layout_weight="1"
      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"
      app:layout_constraintTop_toBottomOf="@+id/tvDate"
      app:initialPositionIndex="11"
      app:longPress="false"
      app:multiSelection="false"
      android:visibility="visible"
      />

and this is how we set up the Kotlin part

singleRowCalendar = binding.mainSingleRowCalendar.apply {
    calendarViewManager = myCalendarViewManager
    calendarChangesObserver = myCalendarChangesObserver
    calendarSelectionManager = mySelectionManager
    initialPositionIndex = 14
    deselection = false
    pastDaysCount = 14
    futureDaysCount = 14
    longPress = false
    //setDates(getFutureDatesOfCurrentMonth())
    init()
    //smooth
}

Do you have any idea how to resolve this?


minSdk = 29
jvmTarget = "18"

implementation("androidx.recyclerview:recyclerview:1.4.0")
implementation("androidx.recyclerview:recyclerview-selection:1.1.0")

id("com.android.application") version "8.8.0" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions