Saturday merger of bf-blender in orange branch.
[blender.git] / source / blender / src / buttons_shading.c
index f12707d7ac457a83334de2bcb978d4bfa3da7393..fcbe1a5d71c57ec1fb85feb5eadc79b75566ca38 100644 (file)
@@ -667,8 +667,12 @@ void do_texbuts(unsigned short event)
                        }
 
                        IMB_freeImBuf(tex->ima->ibuf);
-                       tex->ima->ibuf= 0;
+                       tex->ima->ibuf= NULL;
                        tex->ima->ok= 1;
+                       
+                       if(tex->env)
+                               RE_free_envmapdata(tex->env);
+                       
                        allqueue(REDRAWVIEW3D, 0);
                        allqueue(REDRAWIMAGE, 0);
                        BIF_all_preview_changed();