Fixes for me this issue: gnome-shell#1568 (comment 596599)
I'm not really sure what the patched function should achieve. What I discovered is that the target monitor is not found, thus the loop doesn't set x/y, and thus the result for dx/dy is 0/0 and the cursor is made "sticky" on the edge.
I'm at least pretty sure given the code, this was not the intended behavior, but should have to do something with different scaling.