When the pointer leaves the window surface, gtk_window_capture_motion will not be called anymore, so priv->resize_cursor may remain non-NULL indefinitely without this. If update_cursor is later called...
The issue in the link already has a proposed solution (as far as I understand), but I don't understand how I can "use" that. Can I just copy-pasta the code? Or is it more complicated?
But that was merged a month ago. If you check commit page and unfold Tags containing commit you can see that this is in 4.11.4. So you just need to update GTK to at least 4.11.4