When this glitch is happening, is there any output on the console? (Start Geany with `-v` option)
Another thing would be to run Geany with GDB and see if fires off a lot of threads (GTK+ does this sometimes and it can block, I guess when they're joined). Additionally, in GDB, if you're fast enough and can interrupt it using <kbd>Ctrl</kbd>+<kbd>c</kbd> while it's stuck, the resulting backtrace would probably be useful to see what's it's doing.
A final thing to try might be to run Geany with [GtkInspector](https://wiki.gnome.org/Projects/GTK%2B/Inspector) and see if anything looks fishy with the signals as @elextr mentions.