The file formats affected by this patch are: r16 heightmap/r8 heightmap/JPEG-2000/JPEG/PNG/PPM/PGM/PBM
These formats return KisImportExportFilter::OK rather than KisImportExportFilter::UserCancelled when their import/export options dialog is cancelled.
This leads to buggy behaviour that can be reproduced using either set of the following steps:
CASE 1
- Create a new document and modify it
- Close the document and opt to save it as one of the affected formats
- Cancel when the export options appear
- (The document closes without saving)
CASE 2
- Open a heightmap
- Cancel when the import options appear
- (Krita crashes)
I've also modified kis_png_export.cc so that it sets up the Cancel/OK buttons explicitly instead of relying on getting them by default from KDialog.