Skip to content

Avoid leaking "Create new document" dialogs

Mathias Wein requested to merge mwein/krita:create-document-dialog-leak into master

While investigating the slowness of the copy/cut actions in master (Bug 442972), I noticed the KisImageFromClipboard widget kept producing debug output after the "Create new document" dialog was closed already. Turned out it never gets deleted when you close the dialog with the "x" button in the title bar.

The whole mechanism of closing and deleting seemed really weird, especially KisPart deleting the dialog after casting the signal sender was scary, it can't even know if it was allocated on the heap.

The dialog buttons themselves now take care of closing the dialog, and it gets deleted where it was allocated, that seems to conform better to the intended use of QDialog. I guess we could now just create the dialog on the stack in KisMainWindow, but I didn't want to change more than necessary.

Test Plan

The most likely regression is that I missed some action that should exit the dialog, so check that all ways to complete a "File" -> "New..." action actually closes the dialog.

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