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>2016-02-01 07:15:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-01 07:23:29 +0300
commitc2508b0aaf38a511eb419e340b3aa8a6f981a8c4 (patch)
tree2bd523f510fd1794502fb822e7094577a5bf0315 /source/blender/editors/transform/transform_generics.c
parent17429dce0075a5863030f51741fc3c286ddace1d (diff)
Fix transform crash in rare cases
In some cases transform modes would use the custom-data pointer, other times the transform conversion functions would. However with some combinations (bone mirror + bend for eg), both conversion & transform mode would use this pointer causing a crash. Fix this by having 2 custom-data pointers: one for the mode, another for the data-type. This also simplifies time-slide which was conditionally mixing mode/type data in the one array.
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r--source/blender/editors/transform/transform_generics.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index d43ec0994cb..8d1db148ce5 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -422,7 +422,7 @@ static void recalcData_graphedit(TransInfo *t)
/* helper for recalcData() - for NLA Editor transforms */
static void recalcData_nla(TransInfo *t)
{
- TransDataNla *tdn = (TransDataNla *)t->customData;
+ TransDataNla *tdn = t->custom.type.data;
SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first;
Scene *scene = t->scene;
double secf = FPS;
@@ -1055,10 +1055,10 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
void resetTransModal(TransInfo *t)
{
if (t->mode == TFM_EDGE_SLIDE) {
- freeEdgeSlideVerts(t);
+ freeEdgeSlideVerts(t, &t->custom.mode);
}
else if (t->mode == TFM_VERT_SLIDE) {
- freeVertSlideVerts(t);
+ freeVertSlideVerts(t, &t->custom.mode);
}
}
@@ -1441,14 +1441,20 @@ void postTrans(bContext *C, TransInfo *t)
if (t->draw_handle_cursor)
WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor);
- if (t->customFree) {
- /* Can take over freeing t->data and data2d etc... */
- t->customFree(t);
- BLI_assert(t->customData == NULL);
- }
- else if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) {
- MEM_freeN(t->customData);
- t->customData = NULL;
+ /* Free all custom-data */
+ {
+ TransCustomData *custom_data = &t->custom.first_elem;
+ for (int i = 0; i < TRANS_CUSTOM_DATA_ELEM_MAX; i++, custom_data++) {
+ if (custom_data->free_cb) {
+ /* Can take over freeing t->data and data2d etc... */
+ custom_data->free_cb(t, custom_data);
+ BLI_assert(custom_data->data == NULL);
+ }
+ else if ((custom_data->data != NULL) && custom_data->use_free) {
+ MEM_freeN(custom_data->data);
+ custom_data->data = NULL;
+ }
+ }
}
/* postTrans can be called when nothing is selected, so data is NULL already */