Fix T37464: Crash when pressing "V" in UV/Image editor

Also fix for missing draw-handler free.
Delay activating until we know 'stitch_init' succeeds.
This commit is contained in:
Campbell Barton 2013-11-19 13:34:16 +11:00
parent 74a1e4dcf2
commit 95d3286c65
Notes: blender-bot 2023-02-14 11:35:48 +01:00
Referenced by issue #37464, Crash when pressing "V" in UV/Image editor
1 changed files with 3 additions and 5 deletions

View File

@ -1613,10 +1613,7 @@ static int stitch_init(bContext *C, wmOperator *op)
if (!ar)
return 0;
state = MEM_mallocN(sizeof(StitchState), "stitch state");
if (!state)
return 0;
state = MEM_callocN(sizeof(StitchState), "stitch state");
op->customdata = state;
@ -1648,7 +1645,6 @@ static int stitch_init(bContext *C, wmOperator *op)
}
}
state->draw_handle = ED_region_draw_cb_activate(ar->type, stitch_draw, state, REGION_DRAW_POST_VIEW);
/* in uv synch selection, all uv's are visible */
if (ts->uv_flag & UV_SYNC_SELECTION) {
state->element_map = BM_uv_element_map_create(state->em->bm, false, true);
@ -1926,6 +1922,8 @@ static int stitch_init(bContext *C, wmOperator *op)
return 0;
}
state->draw_handle = ED_region_draw_cb_activate(ar->type, stitch_draw, state, REGION_DRAW_POST_VIEW);
stitch_update_header(state, C);
return 1;
}