Fix T41969: Enviropment map crash

The issue was caused by the threading conflict between main thread which
might free environment map and render thread which might be using that
environment map.

Solved by stopping preview jobs when changing environment map.

Sure there are still ways to run into threading conflict, but would rather
solve this things case-by-case.
This commit is contained in:
Sergey Sharybin 2014-11-18 16:05:47 +01:00
parent 54c6a9fd49
commit 2218135f67

@ -119,6 +119,7 @@ static EnumPropertyItem blend_type_items[] = {
#include "BKE_main.h"
#include "ED_node.h"
#include "ED_render.h"
static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
{
@ -443,8 +444,10 @@ static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Tex *tex = ptr->id.data;
if (tex->env)
if (tex->env) {
ED_preview_kill_jobs(bmain->wm.first, bmain);
BKE_free_envmapdata(tex->env);
}
rna_Texture_update(bmain, scene, ptr);
}