Costume Editor Crashes

  1. What browsers show this problem? Version 80.0.3987.132 (Official Build) (64-bit)
  2. Please share an example project (if possible).
  3. Describes the steps to reproduce this issue. Below
  4. What does Snap! currently do? Crashes
  5. What should Snap! do instead? Not crash.

I drew a filled in black box.
Changed color.
Selected the Paint bucket to fill with the new color.
Clicked several times rapidly.
After about 6-10 clicks SNAP! crashed totally displaying:

Happens in online and offline versions. I can repeatedly cause it to happen.

Don't ask me why I was clicking so many times on a box that had already changed color !
Actually, I was trying to reach a shade of black to match another background.
And could not quite tell if the color was actually changing or not, because it was so close.

vector or bitmap editor?

Bitmap. Did not try vector.

@hardmath123 this is for you!

Maybe the solution is to RAF the floodfilling in chunks of k pixels where k is something unobjectionable like 1024. But I bet Jens won't like that.

I think I have finally been able to reproduce the problem.

The problem only appears when the that "color change" is made with the pipette. If you did the "color change" using the color picker (without using pipette tool), you can repeat the "filling action" (clicking serveral times) with no problem.

@tguneysu, can you confirm this?

Then, the problem is not inside the floodfill function. Now I see a bug inside the getUserColor func. It has color.a = 255 but it must be color.a = 1.

@jens, I test this and I will submit a PR.



Tested and with this fix, the problem disappears. @jens, PR submitted


Thanks as always for getting on top of this!

Hi Joan,
I tried it with and without pipette to select the color.
I believe you might be right that It always happened with the pipette at different times.
And I could not make it happen by just selecting a color from the palette.

I really hope that this is the real problem and you have solved it.