Skip to content

Fix MyPaint brush engine crashing in big sizes

Before this commit, MyPaint brushes would crash on big sizes (easy test: size 1000px on blend+paint) because it was initialized in the stack instead of on the heap. (For future readers, the wrong/stack initialization for big sizes: int array[size]; heap initialization: int array = new array[size]; // and remember to delete [] array;!)

This commit not only removes that initialization which fixes the crash, but also changes it to use a fixed device instead, which should help with memory fragmentization and make the brush engine faster on Windows (hopefully - no benchmarks were done).

BUG:432754

https://bugs.kde.org/show_bug.cgi?id=432754

Test Plan

Open Krita, make documents in various color spaces. Choose blend+paint brush or other smudging brush from MyPaint. Set the size to be 1000px. Paint.

Before this commit, in default color space, 1000px on blend+paint would result in crash on my system.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Agata Cacko

Merge request reports

Loading