forked from bartvdbraak/blender
fix [#30839] Blender crashes while open/close a scene and deletes .blend-file
This commit is contained in:
parent
1b74ec9564
commit
5061f2eb62
@ -892,7 +892,12 @@ bool ConvertMaterial(
|
||||
if (validmat)
|
||||
material->matname =(mat->id.name);
|
||||
|
||||
material->tface = tface;
|
||||
if (tface) {
|
||||
material->tface = *tface;
|
||||
}
|
||||
else {
|
||||
memset(&material->tface, 0, sizeof(material->tface));
|
||||
}
|
||||
material->material = mat;
|
||||
return true;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void BL_Material::Initialize()
|
||||
alpha = 1.f;
|
||||
emit = 0.f;
|
||||
material = 0;
|
||||
tface = 0;
|
||||
memset(&tface, 0, sizeof(tface));
|
||||
materialindex = 0;
|
||||
amb=0.5f;
|
||||
num_enabled = 0;
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "STR_String.h"
|
||||
#include "MT_Point2.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
#ifdef WITH_CXX_GUARDEDALLOC
|
||||
#include "MEM_guardedalloc.h"
|
||||
@ -83,7 +84,7 @@ public:
|
||||
|
||||
|
||||
Material* material;
|
||||
MTFace* tface;
|
||||
MTFace tface; /* copy of the derived meshes tface */
|
||||
Image* img[MAXTEX];
|
||||
EnvMap* cubemap[MAXTEX];
|
||||
|
||||
|
@ -118,8 +118,7 @@ KX_BlenderMaterial::~KX_BlenderMaterial()
|
||||
MTFace* KX_BlenderMaterial::GetMTFace(void) const
|
||||
{
|
||||
// fonts on polys
|
||||
MT_assert(mMaterial->tface);
|
||||
return mMaterial->tface;
|
||||
return &mMaterial->tface;
|
||||
}
|
||||
|
||||
unsigned int* KX_BlenderMaterial::GetMCol(void) const
|
||||
@ -238,9 +237,7 @@ void KX_BlenderMaterial::OnExit()
|
||||
/* used to call with 'mMaterial->tface' but this can be a freed array,
|
||||
* see: [#30493], so just call with NULL, this is best since it clears
|
||||
* the 'lastface' pointer in GPU too - campbell */
|
||||
if (mMaterial->tface) {
|
||||
GPU_set_tpage(NULL, 1, mMaterial->alphablend);
|
||||
}
|
||||
GPU_set_tpage(NULL, 1, mMaterial->alphablend);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user