Butterfly icon indicating copy to clipboard operation
Butterfly copied to clipboard

[Bug]: Crash during hand tool movements

Open chriscavalluzzi opened this issue 8 months ago • 3 comments

What happened?

When moving around the canvas with v2.3.0-beta.4 on Android, the app will frequently crash.

Steps to reproduce: ⚠️ Warning: Reproducing this on an Android emulator on my PC caused my entire PC to crash!

  1. Open a document
  2. Select the hand tool
  3. Perform many movements very quickly

https://github.com/user-attachments/assets/ade17563-9338-4067-81ee-c37bb4a3b1c0

This is just the fastest way to trigger the crash. When working normally, the crash becomes easier to trigger over time, and eventually it will be triggered by a single move or scale. This makes me feel like it might be related to a memory leak.

I found that short-circuiting this function (inserting a return at line 653) prevents the crash, so I believe the crash is related to baking or something that happens as a result of baking. https://github.com/LinwoodDev/Butterfly/blob/98178a9261b3d5fdae68d3ec80e7c5e229970534/app/lib/cubits/current_index.dart#L648

Version

v2.3.0-beta.4

Platform

Android

Relevant log output

Both flutter and adb logcat don't seem to produce any logs about the crash :(

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

chriscavalluzzi avatar Apr 12 '25 16:04 chriscavalluzzi

Hmm thats not good, if you found a solution feel free to create a pr. If you are struggeling, feel free to answer and i will try to find the cause

CodeDoctorDE avatar Apr 12 '25 23:04 CodeDoctorDE

Bug confirmed, I found the fix that fixed it on the develop branch but I don't know if this really fixes the problem in the released 2.4.0-beta.4 because i just changed it to the previous behavior.

Bake isn't run everytime now, but we need to see if this really fixes the problem

CodeDoctorDE avatar Apr 13 '25 10:04 CodeDoctorDE

Thank you for fixing that! That returned develop to the beta 4 behavior, so I was still able to reproduce the crash on rc0, but it was definitely better than on develop previously.

I think I've found a way to make the issue disappear completely, so I'll be opening a PR shortly!

chriscavalluzzi avatar Apr 14 '25 05:04 chriscavalluzzi