Bug 443183 - New File dialog startup time is dependent on size of image in clipboard
Summary: New File dialog startup time is dependent on size of image in clipboard
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 5.0.0-beta1
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 426734 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-01 00:39 UTC by tomtomtomreportingin
Modified: 2022-09-19 13:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomtomtomreportingin 2021-10-01 00:39:27 UTC
SUMMARY
The size of the image saved to the system clipboard can strongly impact the startup time of the New File dialog, even though the user might not necessarily plan to use Create from Clipboard.

Not a regression of Krita 5.

STEPS TO REPRODUCE
1. Download the source jpeg from https://www.peppercarrot.com/en/viewer/artworks__2020-01-25_cover_book-project_by-David-Revoy.html from the top left. (the file should be 8.3 MB)
2. Open it in Krita.
3. Cut the image with Ctrl + X.
4. Open a New File dialog.

OBSERVED RESULT
On my computer it takes a couple seconds for the New File dialog to pop up. Confirm the difference by cutting a small stroke.

EXPECTED RESULT
Startup time of the dialog should be basically instant.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian sid
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.12.11 (Appimage)
Comment 1 Halla Rempt 2022-07-12 12:39:56 UTC
Git commit 4d025b799e644203e1b985439af05be3cff77101 by Halla Rempt.
Committed on 12/07/2022 at 12:39.
Pushed by rempt into branch 'master'.

Only create the clip preview when the image from clip widget is shown

M  +4    -2    libs/ui/widgets/kis_custom_image_widget.h
M  +7    -3    libs/ui/widgets/kis_image_from_clipboard_widget.cpp
M  +4    -1    libs/ui/widgets/kis_image_from_clipboard_widget.h

https://invent.kde.org/graphics/krita/commit/4d025b799e644203e1b985439af05be3cff77101
Comment 2 Halla Rempt 2022-07-12 12:40:14 UTC
Git commit 3d7b2e017e49276064ceafce7932a72359541aad by Halla Rempt.
Committed on 12/07/2022 at 12:40.
Pushed by rempt into branch 'krita/5.1'.

Only create the clip preview when the image from clip widget is shown
(cherry picked from commit c0785aafac25d74465a06ebdfd3ff17832911554)

M  +4    -2    libs/ui/widgets/kis_custom_image_widget.h
M  +7    -3    libs/ui/widgets/kis_image_from_clipboard_widget.cpp
M  +4    -1    libs/ui/widgets/kis_image_from_clipboard_widget.h

https://invent.kde.org/graphics/krita/commit/3d7b2e017e49276064ceafce7932a72359541aad
Comment 3 tomtomtomreportingin 2022-07-15 14:26:10 UTC
I'm sorry but I think the fix might have made the issue worse for a different case: If I copy the image from the browser instead of from Krita, then I get both the added startup time for both the dialog AND when clicking "Create from Clipboard". Creating the image from clipboard itself will also take a while until I get the prompt for how Krita should read the image from the clipboard.

It seems to be fine with the initally reported case of copying from Krita itself.
Comment 4 Halla Rempt 2022-07-15 15:35:22 UTC
That's not possible? The clip is only created when the clipboard page is shown.
Comment 5 Halla Rempt 2022-08-11 11:26:44 UTC
Okay, even if I completely remove the clipboard widget, having a large image on the clipboard makes the new image dialog take more time to show.
Comment 6 Halla Rempt 2022-08-11 11:33:55 UTC
Ah, that was because I copied and pressed ctrl-n before krita was done loading the clip.
Comment 7 Bug Janitor Service 2022-08-11 12:06:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1540
Comment 8 Halla Rempt 2022-08-12 05:39:40 UTC
Git commit bdf06f6511a8c29a3988b021cedca0b23a0a74b7 by Halla Rempt.
Committed on 12/08/2022 at 05:39.
Pushed by rempt into branch 'master'.

Only access the clipboard when we really need it

* remove two superfluous sig/slot connections in KisClipboard.
These QClipboard modes are not relevant for Krita, and were
fired together with dataChanged, resulting in clipboardChanged
being called three times.
* remove the preview() method which was only used by the
custom image widget
* set the default w/h for the imagefromclipboard widget to 1,
so we don't need to retrieve the QImage from the clipboard just
to get the actual dimensions
* simplify KisClipboard::clipboardDataChanged so it doesn't need
to retrieve the qimage from the clipboard. This means that hasClip()
can be true because there are images on the qclipboard, so that needs
to be tested.

M  +3    -9    libs/ui/KisMainWindow.cpp
M  +3    -40   libs/ui/kis_clipboard.cc
M  +0    -3    libs/ui/kis_clipboard.h
M  +0    -1    libs/ui/widgets/kis_custom_image_widget.cc
M  +23   -9    libs/ui/widgets/kis_image_from_clipboard_widget.cpp
M  +4    -4    libs/ui/widgets/kis_image_from_clipboard_widget.h

https://invent.kde.org/graphics/krita/commit/bdf06f6511a8c29a3988b021cedca0b23a0a74b7
Comment 9 Halla Rempt 2022-08-12 05:40:07 UTC
Git commit 2b4743edc4c6a8d0a2ad35bfcd270a2c6dcca7e5 by Halla Rempt.
Committed on 12/08/2022 at 05:39.
Pushed by rempt into branch 'krita/5.1'.

Only access the clipboard when we really need it

* remove two superfluous sig/slot connections in KisClipboard.
These QClipboard modes are not relevant for Krita, and were
fired together with dataChanged, resulting in clipboardChanged
being called three times.
* remove the preview() method which was only used by the
custom image widget
* set the default w/h for the imagefromclipboard widget to 1,
so we don't need to retrieve the QImage from the clipboard just
to get the actual dimensions
* simplify KisClipboard::clipboardDataChanged so it doesn't need
to retrieve the qimage from the clipboard. This means that hasClip()
can be true because there are images on the qclipboard, so that needs
to be tested.
(cherry picked from commit bdf06f6511a8c29a3988b021cedca0b23a0a74b7)

M  +3    -9    libs/ui/KisMainWindow.cpp
M  +3    -40   libs/ui/kis_clipboard.cc
M  +0    -3    libs/ui/kis_clipboard.h
M  +0    -1    libs/ui/widgets/kis_custom_image_widget.cc
M  +23   -9    libs/ui/widgets/kis_image_from_clipboard_widget.cpp
M  +4    -4    libs/ui/widgets/kis_image_from_clipboard_widget.h

https://invent.kde.org/graphics/krita/commit/2b4743edc4c6a8d0a2ad35bfcd270a2c6dcca7e5
Comment 10 Halla Rempt 2022-09-19 13:00:08 UTC
*** Bug 426734 has been marked as a duplicate of this bug. ***