Further fix for #34121: OSL + persistent images could crash in some cases still.

git-svn-id: https://svn.blender.org/svnroot/bf-blender/trunk/blender@54557 954f8c5b-7b00-dc11-b283-0030488c597c