[Bf-blender-cvs] [95d3286] master: Fix T37464: Crash when pressing "V" in UV/Image editor

Campbell Barton noreply at git.blender.org
Tue Nov 19 03:37:07 CET 2013


Commit: 95d3286c65e034d9801c2623e81ef92a06e6cc8c
Author: Campbell Barton
Date:   Tue Nov 19 13:34:16 2013 +1100
http://developer.blender.org/rB95d3286c65e034d9801c2623e81ef92a06e6cc8c

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.

===================================================================

M	source/blender/editors/uvedit/uvedit_smart_stitch.c

===================================================================

diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index c234d17..28e2823 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -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;
 }




More information about the Bf-blender-cvs mailing list