diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-11-26 07:47:20 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-11-26 07:47:20 +0400 |
commit | e77e1f183ae6732eadda82ba1d7ab9975a9224f8 (patch) | |
tree | 080f565b65e74203b8f7bf6717bb6d9c27251195 /source/blender/editors/animation | |
parent | 3d64381e4de22c8c65177b8f8d1b541284ae4483 (diff) |
fix for uninitialized memory use with numeric input:
bevel/inset/marker-move would use uninitialized memory when used as modal operators and pressing backspace after entering values.
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 4ac7b61fccb..d595034032e 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -860,16 +860,21 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) } if (evt->val == KM_PRESS) { - float vec; - char str_tx[NUM_STR_REP_LEN]; - if (handleNumInput(&mm->num, evt)) { - applyNumInput(&mm->num, &vec); - outputNumInput(&mm->num, str_tx); - - RNA_int_set(op->ptr, "frames", vec); + char str_tx[NUM_STR_REP_LEN]; + float value = RNA_int_get(op->ptr, "frames"); + applyNumInput(&mm->num, &value); + + if (hasNumInput(&mm->num)) { + outputNumInput(&mm->num, str_tx); + } + else { + BLI_snprintf(str_tx, sizeof(str_tx), "%d", (int)value); + } + + RNA_int_set(op->ptr, "frames", value); ed_marker_move_apply(C, op); - // ed_marker_header_update(C, op, str, (int)vec[0]); + // ed_marker_header_update(C, op, str, (int)value); // strcat(str, str_tx); BLI_snprintf(str, sizeof(str), "Marker offset %s", str_tx); ED_area_headerprint(CTX_wm_area(C), str); |