masks: avoid jumping and flickering

this is a new version of https://github.com/darktable-org/darktable/pull/784, much simpler

to securise pipe acces across thread in distort fct, we use the dev->history_mutex.

There was another pb specific to clipping iop, where we can have some data value not already computed, as the computing is done in modify_roi_out