[gimp] app: don't crash if GimpBrushTool has no dynamics to paint a brush outline
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't crash if GimpBrushTool has no dynamics to paint a brush outline
- Date: Thu, 24 Mar 2011 19:23:37 +0000 (UTC)
commit afa8a416c9e2b3aa65eb9dde75b838360cb2e0d6
Author: Michael Natterer <mitch gimp org>
Date: Thu Mar 24 20:20:24 2011 +0100
app: don't crash if GimpBrushTool has no dynamics to paint a brush outline
Also, set the BAD cursor when there isn't both brush and dynamics
available.
app/tools/gimpbrushtool.c | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/app/tools/gimpbrushtool.c b/app/tools/gimpbrushtool.c
index 21f8114..6be7a97 100644
--- a/app/tools/gimpbrushtool.c
+++ b/app/tools/gimpbrushtool.c
@@ -236,22 +236,28 @@ gimp_brush_tool_cursor_update (GimpTool *tool,
GimpDisplay *display)
{
GimpBrushTool *brush_tool = GIMP_BRUSH_TOOL (tool);
+ GimpBrushCore *brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
- if (! brush_tool->show_cursor &&
- ! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)) &&
- gimp_tool_control_get_cursor_modifier (tool->control) !=
- GIMP_CURSOR_MODIFIER_BAD)
- {
- gimp_tool_set_cursor (tool, display,
- GIMP_CURSOR_NONE,
- GIMP_TOOL_CURSOR_NONE,
- GIMP_CURSOR_MODIFIER_NONE);
- }
- else
+ if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
- GIMP_TOOL_CLASS (parent_class)->cursor_update (tool,
- coords, state, display);
+ if (! brush_core->main_brush || ! brush_core->dynamics)
+ {
+ gimp_tool_control_set_cursor_modifier (tool->control,
+ GIMP_CURSOR_MODIFIER_BAD);
+ }
+ else if (! brush_tool->show_cursor &&
+ gimp_tool_control_get_cursor_modifier (tool->control) !=
+ GIMP_CURSOR_MODIFIER_BAD)
+ {
+ gimp_tool_set_cursor (tool, display,
+ GIMP_CURSOR_NONE,
+ GIMP_TOOL_CURSOR_NONE,
+ GIMP_CURSOR_MODIFIER_NONE);
+ return;
+ }
}
+
+ GIMP_TOOL_CLASS (parent_class)->cursor_update (tool, coords, state, display);
}
static void
@@ -307,7 +313,10 @@ gimp_brush_tool_draw_brush (GimpBrushTool *brush_tool,
brush_core = GIMP_BRUSH_CORE (GIMP_PAINT_TOOL (brush_tool)->core);
options = GIMP_PAINT_TOOL_GET_OPTIONS (brush_tool);
- if (! brush_core->brush_bound_segs && brush_core->main_brush)
+ if (! brush_core->main_brush || ! brush_core->dynamics)
+ return;
+
+ if (! brush_core->brush_bound_segs)
gimp_brush_core_create_boundary (brush_core, options);
if (brush_core->brush_bound_segs &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]