Skip to content

Fix crash on incorrect brush preset metadata

Before this commit, if you tried to open a brush preset that had incorrect brush metadata (for example any brush saved in Krita 5.1 beta 1, with < changed to < etc.), Krita would crash. This commit ensures it will not crash in that case.

It's not an ideal solution, because there is no way to propagate the information about the issue and the safe assert around line 370 in KisBrushBasedPaintOpSettings::regenerateResourceCache() would still be fired. However it's less disruptive for the user.

Potentially, a better solution should be found and implemented. Right now, there is no good way to tell the KisPaintOpPreset that it's settings are incorrect in such way.

Test Plan

  • download DPS_air_1_old.kpp
  • put it in your resources folder
  • open Krita, try to select it (make sure to select in the docker, in case it does crash, so it doesn't crash your whole X11)

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.

Merge request reports

Loading