Anyway, while wrong, the behavior is not the same, so I can't be sure
it's the same problem that is being triggered.
I don't really see any useful information here, except that the last
call tells Emacs to show the cursor using type NO_CURSOR (i.e. not to
display anything).
I don't understand why this happens; the value is
returned by get_window_cursor_type called inside
display_and_set_cursor (which is what gui_update_window_end calls on
line 3941 of dispnew.c, but the backtrace doesn't even mention that).
But before we try to analyze this situation, shouldn't we try to stick
to the original issue? Why could not you investigate what happens in
that case?
Also, if the problem persists in a non-optimized build, I suggest to
use that, since then the backtraces will be much more helpful, and
there will be no "optimized-out" variables whose values you cannot see
in the debugger.