SUMMARY When I open a relatively big image file in Gimp and copy/paste it into LibreOffice Writer, the image isn't pasted and Gimp closes after crash. STEPS TO REPRODUCE 1. Open a big image in Gimp Image Manipulation Program. 2. Copy the image. 3. Paste it in LibreOffice Writer. OBSERVED RESULT Most times the image isn't pasted and Gimp crashes and closes. EXPECTED RESULT The image should be pasted in LibreOffice Writer. SOFTWARE/OS VERSIONS Linux/KDE Plasma: KDE Neon KDE Plasma Version: 5.19.13 KDE Frameworks Version: 5.72.0 Qt Version: 5.14.2 Gimp version: 2.10.14 LibreOffice: 6.4.5.2 ADDITIONAL INFORMATION a) When I open Gimp by the terminal and this bug occurs, the error message is: "The program 'gimp' received an X Window System error. This probably reflects a bug in the program. The error was 'BadWindow (invalid Window parameter)'. (Details: serial 20286 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:31012): LibGimpBase-WARNING **: 11:02:31.293: script-fu: gimp_wire_read(): error" --- b) This problem is present in the Gimp forum by this link: https://gitlab.gnome.org/GNOME/gimp/-/issues/789
KWindowSystem is not involved in the process of copy/pasting images. It sounds to me like GIMP exceeds the maximum X11 request size limit. However, if GIMP uses Xlib, then the image data should be chopped into multiple chunks behinds the scenes. We had a similar bug in the screenshot service in kwin long time ago. The root cause of the bug was that libxcb doesn't split big images in chunks, the caller must do it manually.
Another test: when I copy the big image from the link "https://i.imgur.com/1ADl4cs.png" using Firefox and I paste it into LibreOffice Writer, it doesn't crash, but the image isn't pasted. The curious is: if I use Google Chrome, for example, when the image in the same link "https://i.imgur.com/1ADl4cs.png" is copied and pasted into LibreOffice Writer, it works fine with no problem. I change the product to Klipper, It looks like a clipboard problem.
As Vlad says, this is a problem either in GIMP, or XLib, or libxcb.