Skip to content

Fix KIS(_SAFE)_ASSERT_BREAK not working

Putting do_while block around "break" prevents the ASSERT_BREAK from working. This commit partially reverts b9f7132e and removes the block so the asserts can work again.

CCMAIL:kimageshop@kde.org

Test Plan

I guess just putting a KIS_ASSERT_BREAK in some obvious place.

I noticed this problem in Coverity, issue 305034, it simply made no sense if the assert worked correctly, so it had to mean it didn't, and looking at the code, while I admit I'm not the best in macros, it does look wrong. It seems like it was only changed three years ago when all asserts got the do_while block (so the author probably wasn't thinking deeply about the BREAK assert specifically), and that specific assert is used rarely, which explains why it wasn't caught earlier.

obraz

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.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Amy spark

Merge request reports