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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 22:19:35 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 22:19:35 +0400
commit902eb76f49a47cc05d6d874bb0f52cee413d33b1 (patch)
treef10d2599d5ab5bece207d660b99bf601c493edeb /source/blender
parent6ab23d5a0123359b90ab0bccf8c99ad38a23976c (diff)
Fix #34849: crash in operator search menu, due to brush stencil poll
function not checking NULL pointer.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c18
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
2 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 2054a013bde..76b01bc7f57 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -62,7 +62,7 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
{
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint = paint_get_active_from_context(C);
- struct Brush *br = paint_brush(paint);
+ Brush *br = paint_brush(paint);
Main *bmain = CTX_data_main(C);
if (br)
@@ -94,7 +94,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Paint *paint = paint_get_active_from_context(C);
- struct Brush *brush = paint_brush(paint);
+ Brush *brush = paint_brush(paint);
// Object *ob = CTX_data_active_object(C);
float scalar = RNA_float_get(op->ptr, "scalar");
@@ -176,10 +176,10 @@ static void PAINT_OT_vertex_color_set(wmOperatorType *ot)
static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
{
Paint *paint = paint_get_active_from_context(C);
- struct Brush *brush = paint_brush(paint);
+ Brush *brush = paint_brush(paint);
Object *ob = CTX_data_active_object(C);
- if (!ob) return OPERATOR_CANCELLED;
+ if (!ob || !brush) return OPERATOR_CANCELLED;
if (ob->mode & OB_MODE_SCULPT)
BKE_brush_sculpt_reset(brush);
@@ -215,7 +215,7 @@ static void brush_tool_set(const Brush *brush, size_t tool_offset, int tool)
/* generic functions for setting the active brush based on the tool */
static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, const size_t tool_offset, const int ob_mode)
{
- struct Brush *brush;
+ Brush *brush;
if (!brush_orig && !(brush_orig = bmain->brush.first)) {
return NULL;
@@ -266,7 +266,7 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
const char *tool_name, int create_missing,
int toggle)
{
- struct Brush *brush, *brush_orig = paint_brush(paint);
+ Brush *brush, *brush_orig = paint_brush(paint);
if (toggle)
brush = brush_tool_toggle(bmain, brush_orig, tool, tool_offset, ob_mode);
@@ -467,7 +467,7 @@ typedef struct {
static int stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Paint *paint = paint_get_active_from_context(C);
- Brush *br = paint->brush;
+ Brush *br = paint_brush(paint);
int mdiff[2];
StencilControlData *scd = MEM_mallocN(sizeof(StencilControlData), "stencil_control");
@@ -567,9 +567,9 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
static int stencil_control_poll(bContext *C)
{
Paint *paint = paint_get_active_from_context(C);
- Brush *br = paint->brush;
+ Brush *br = paint_brush(paint);
- return br->mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL;
+ return (br && br->mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL);
}
static void BRUSH_OT_stencil_control(wmOperatorType *ot)
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 47e20bcc5fb..b54e515bd6d 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -381,7 +381,9 @@ void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* fron
static int brush_curve_preset_exec(bContext *C, wmOperator *op)
{
Brush *br = paint_brush(paint_get_active_from_context(C));
- BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
+
+ if(br)
+ BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape"));
return OPERATOR_FINISHED;
}