Fixed a big race condition: The output image lock was not taken soon
enough and a thread might have removed the image from the cache while
another one would rely on the infos stored in the cache. This has been
fixed by placing the image locker at the good position.

- When toggling preview image, it is automatically computed regardless
of the project's auto-preview mode.