This replaces !1984 (closed).
I fixed the reviewers comments from !1984 (closed):
- no debug statements, inline the code
- not calling a function called only a few places.
I did not fix the ifdef APPLE because otherwise it creates an unnecessary dependence on gtk in app/plug-in/meson.build
Might need backport to 2.10, if the symptoms occur there. If #6577 (closed) didn't really fix it. And we plan a bug fix release of 2.10.