Closed abdallahmehiz closed 2 months ago
I will look into it. Are there any steps to reproduce the crash?
I will look into it. Are there any steps to reproduce the crash?
Since it's an issue of comparing floats, it is reproducible only through chance. You can't make it crash consistently, but it will eventually crash. Here is an example: here it took me quite a few tries, but it eventually crashed be cause of this bug. Sometimes it takes less tries, sometimes more.
https://github.com/user-attachments/assets/1748fbaa-167e-4635-84a4-103e151037eb
I've found out that it was actually not seeker causing the crashes, but mpv giving me an unordered chapters list. So I am closing this.
I suspected it. I wrote a script to compare a million floats within a range in kotlin, and it turns out to be all correct. Take a look here: https://pl.kotl.in/fpz8mXqTQ
I was digging into the kotlin code to check how float comparisons happen in kotlin, comparison symbols (<=)
call the operator fun compareTo()
which looks like takes care of the precision.
I am using this library in my media player mpvKt and I've been seeing a lot crashes happening because of seeker (happening randomly too) Until i discovered it was happening due to this bug: https://github.com/2307vivek/Seeker/blob/e6e7ee26ca28484fbbbdcdf815687f13c090b818/seeker/src/main/java/dev/vivvvek/seeker/Seeker.kt#L131
Comparing floats is known to cause issues...