KWin lags severely after closing an OpenGL program, but only with external monitor connected

When my external monitor is connected (HDMI) to my laptop and I close an OpenGL program, all my desktop windows lag and appear to only refresh about once every two seconds. I've looked around and found one or two accounts of this happening with an Nvidia graphics processor, but mine is Intel so I can't try their suggested solutions.

This only happens when the second monitor is connected, and I can fix it by disconnecting it. When I'm just using my laptop screen, it seems to work correctly. This isn't too much of a problem when playing games, since I can just disconnect briefly when I'm finished playing, but I've started developing a small python game using OpenGL and it's become frustrating.

Here is the similar account I referenced.


Solution 1:

I was eventually given the solution by someone over on kde.org who read my bug report. This problem was fixed in one of the later KDE updates, so it shouldn't become an issue, but just in case someone isn't updating/ that didn't fix it for them, it's fixed by installing the qml-module-org-kde-sonnet package (available in apt).