Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-04-30 00:21:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-30 00:21:19 +0400
commit1edf56e7a5998b5f2efdb4f96883556923376eb6 (patch)
tree27bf80d9d1009184c2eb86cbd385c98155753eb9 /source/blender/bmesh
parentaa2a0e4ab00a803743141af258a1ff1515182420 (diff)
fix [#35150] Crash when bmesh operation called from within a Panel draw()
accessing a bmesh from python would reallocate all customdata layers. add an assert to BM_data_layer_free(), when its called unnecessarily since its reallocating all layers.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index c0975897090..290c6d9c9c8 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -804,6 +804,7 @@ void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
{
CustomData olddata;
+ bool has_layer;
olddata = *data;
olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
@@ -811,7 +812,9 @@ void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
/* the pool is now owned by olddata and must not be shared */
data->pool = NULL;
- CustomData_free_layer_active(data, type, 0);
+ has_layer = CustomData_free_layer_active(data, type, 0);
+ /* assert because its expensive to realloc - better not do if layer isnt present */
+ BLI_assert(has_layer != false);
update_data_blocks(bm, &olddata, data);
if (olddata.layers) MEM_freeN(olddata.layers);
@@ -820,6 +823,7 @@ void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
{
CustomData olddata;
+ bool has_layer;
olddata = *data;
olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
@@ -827,7 +831,9 @@ void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
/* the pool is now owned by olddata and must not be shared */
data->pool = NULL;
- CustomData_free_layer(data, type, 0, CustomData_get_layer_index_n(data, type, n));
+ has_layer = CustomData_free_layer(data, type, 0, CustomData_get_layer_index_n(data, type, n));
+ /* assert because its expensive to realloc - better not do if layer isnt present */
+ BLI_assert(has_layer != false);
update_data_blocks(bm, &olddata, data);
if (olddata.layers) MEM_freeN(olddata.layers);