fix UI freezes by replacing deprecated Gdk.threads_init/threads_leave