I'm feeling pretty convinced that the hiding of the the GtkWindow which is the wait dialog is the culprit here. It seems like if hide is called on a widget that is not shown at that time then the wrong window (i.e. the parent window) will get hidden instead. Trying to detect whether the widget is hidden seems to not really work very well. It doesn't fix the problem.
I'm feeling pretty convinced that the hiding of the the GtkWindow which is the wait dialog is the culprit here. It seems like if hide is called on a widget that is not shown at that time then the wrong window (i.e. the parent window) will get hidden instead. Trying to detect whether the widget is hidden seems to not really work very well. It doesn't fix the problem.