Gimp Crash on Clipboard Operations when a Clipboard Manager is in use
GIMP version: 2.10.* (2.8 series and possibly earlier)
Operating System: Linux (Arch in my case)
Package: Any? (Arch extra repository in my case)
Description of the bug
Gimp crashes when trying to copy and paste a selection or layer and you have one of a few select clipboard managers installed or XnViewMP is open when doing this operation.
This bug has been around for quite some time and is referenced by many bug reports both here and elsewhere. This is an attempt to collate these reports to a single post in the hopes it can serve as a starting point in fixing this.
Reproduction
The bug can be reproduced in many ways as is noted in many bug reports. The common thread seems to be the larger the image, the more common the crash. PNG files also seem to cause the crash more than other formats for some reason. In my own experience, even if there is no crash, you will still experience a large performance hit during the copy process.
Reproduction steps:
- Have one of the following programs installed and open on your system. (xnviewmp, copyq, gpaste, possibly krita and klipper, and probably others..)
- Open a large image in gimp. 6k x 8k or similar png is a good starting point.
- Copy a large selection or the entire layer.
Can also happen like this:
- Open known offending image.
- Copy the layer and paste as a new layer.
- Now open XnViewMP. …
Expected result: Normal clipboard operations.
Actual result: Gimp crashes.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 314790 error_code 3 request_code 18 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
(script-fu:14629): LibGimpBase-WARNING **: 19:09:58.461: script-fu: gimp_wire_read(): error
Additional information
I made a few videos showing the problem in action. Here is the image used in the videos.
https://yande.re/post/show/161340
Video 1: (5.4mb, 50s) In this video I open an image from XnviewMP into gimp. Next, (using shortcuts) I copy the base layer and paste as a new layer. You will notice as soon as the copy is made that the cursor goes into busy mode until the crash about 10 seconds later.
Video 2: (9.0mb, 62s) In this video I open the image directly into gimp without XnViewMP being open. I again copy the base layer and paste it as a new layer twice, and you will notice this time the operation is almost instant, and of course without a crash. Now when I try to launch XnViewMP, you can see it hang for a bit and then gimp will crash. You will notice in the gimp console that it is writing to the clipboard right before it crashes. Once gimp finishes it's crash, XnViewMP resumes to load and open.
Video 3: (9.2mb, 72s) More of a reference video than anything. Here I open the image from gthumb and show that you can copy and paste just fine without lag or crash. Do note that the error when gimp is closing happens whether gthumb is open or not.
clipboard: sending image data as 'image/x-xcf'
clipboard: sending image data as 'image/png'
(gimp-2.10:9520): GLib-CRITICAL **: 09:37:07.076: Source ID 23198 was not found when attempting to remove it
EXIT: app_exit_after_callback
gimp-2.10: GEGL-WARNING: (gegl-tile-handler-cache.c:977):gegl_tile_cache_destroy: runtime check failed: (g_queue_is_empty (&cache_queue))
EEEEeEeek! 4 GeglBuffers leaked
Other notes:
-
It was mentioned before that this might be a configuration problem. I have found that it does crash less often with a bare gimp profile as a new user, but I can still get it to fail and the lag is still there. Might be just a matter of less resources?
-
I used XnViewMP to cause the crashing instead of a clipboard manager as it's just easier to open/close and manipulate. The same results should be experienced with the clipboard managers referenced. If you are running a KDE desktop, it seems you could use krita instead of XnViewMP, or klipper instead of CopyQ.
-
I have no idea if this is a gimp bug, or all these other programs are doing something wrong, but gimp seems to be the program that's affected. Since there are programs and clipboard managers that don't cause this bug, isn't it possible to see what all the offending programs are doing the same, and how that's different from programs that don't cause the crash?
Reference bugs/threads
https://github.com/lxqt/lxqt/issues/858
https://github.com/hluk/CopyQ/issues/636
https://forum.manjaro.org/t/gimp-closing-when-i-use-krita-manjaro-i3/48132
https://bugzilla.gnome.org/show_bug.cgi?id=320945
https://bbs.archlinux.org/viewtopic.php?id=233140
Seems Related and apparently was fixed there: