I had a similar issue once with my Wacom tablet it was a broken driver. Basically the tablet disconnect for a fraction of a second, which made Krita (or any application) think the cursor moved to somewhere else in an instant when it reconnected or something and it drew a line to that position.