Polygon tool does not get reset e.g. when switching photos

Especially noticeable in the "clicking" mode: start placing polygon points, and before finishing, switch to another photo. You will continue drawing the polygon on the new photo.

Not sure if this can happen in the "dragging" mode -- for that, the photo would have to be switched with keyboard.

Also, careful about Ctrl+Z, Ctrl+Y -- these should probably also reset polygon drawing. Some other actions too -- rotating the photo, resizing, running plugins... Basically any action other than placing another point (left click on image) or finishing the polygon (double left click on image) should probably reset the tool.