Skip to content

Fix waitForDone() not waiting for transform mask update

Before this commit, if you had a very slow transform mask in an image and you used a script to enable it, then running waitForDone() wasn't enough to ensure that the transform mask stopped updating before running any other code. This commit ensures that it does wait until all the updates are done.

BUG:485053

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

Test Plan

Test file can be just a simple document with one transform mask attached to a paint layer with a scribble. The transform mask should heavily use Liquify transform, since it is the slowest one at the moment.

test485053_proper.kra

Steps to reproduce:

  1. Create test file
  2. Disable the transform mask (so there will be some updates)
  3. Run the script

Example test script (use in Scripter): (comes from the bug report)

from krita import *

doc = Krita.instance().activeDocument()
doc.activeNode().setVisible(True)

 #doc.refreshProjection()
doc.activeNode().setBlendingMode(doc.activeNode().blendingMode())
doc.waitForDone()

try:
    doc.setBatchmode(True)
    exportParameters = InfoObject()
    exportParameters.setProperty("alpha", True)
    exportParameters.setProperty("compression", 6)  # 0-9
    exportParameters.setProperty("indexed", False)
    if not doc.exportImage('/path/to/file/test485053.png', exportParameters):
        dialog = QMessageBox()
        dialog.setText("Error exporting")
        dialog.exec()
finally:
    doc.setBatchmode(False)

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 Agata Cacko

Merge request reports