[gimp] Bug 603711 - Crashes when using path tool
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Bug 603711 - Crashes when using path tool
- Date: Sun, 31 Jan 2010 16:21:29 +0000 (UTC)
commit 74bf91cb63ec9ee64d7f2ab2c1b58f118b0f61e1
Author: Michael Natterer <mitch gimp org>
Date: Sun Jan 31 17:19:51 2010 +0100
Bug 603711 - Crashes when using path tool
gimp_display_shell_get_*_coord(): initialize the coords with
GIMP_COORDS_DEFAULT_VALUES allGimpCoords members get initialized.
app/display/gimpdisplayshell-coords.c | 48 +++++++++++---------------------
1 files changed, 17 insertions(+), 31 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-coords.c b/app/display/gimpdisplayshell-coords.c
index 46f1703..73e3e11 100644
--- a/app/display/gimpdisplayshell-coords.c
+++ b/app/display/gimpdisplayshell-coords.c
@@ -36,6 +36,10 @@
static void gimp_display_shell_interpolate_stroke (GimpDisplayShell *shell,
GimpCoords *coords);
+
+static const GimpCoords default_coords = GIMP_COORDS_DEFAULT_VALUES;
+
+
/* public functions */
gboolean
@@ -44,38 +48,34 @@ gimp_display_shell_get_event_coords (GimpDisplayShell *shell,
GdkDevice *device,
GimpCoords *coords)
{
- if (gdk_event_get_axis (event, GDK_AXIS_X, &coords->x))
+ gdouble x;
+
+ if (gdk_event_get_axis (event, GDK_AXIS_X, &x))
{
+ *coords = default_coords;
+
+ coords->x = x;
gdk_event_get_axis (event, GDK_AXIS_Y, &coords->y);
/* CLAMP() the return value of each *_get_axis() call to be safe
- * against buggy XInput drivers. Provide default values if the
- * requested axis does not exist.
+ * against buggy XInput drivers.
*/
if (gdk_event_get_axis (event, GDK_AXIS_PRESSURE, &coords->pressure))
coords->pressure = CLAMP (coords->pressure, GIMP_COORDS_MIN_PRESSURE,
GIMP_COORDS_MAX_PRESSURE);
- else
- coords->pressure = GIMP_COORDS_DEFAULT_PRESSURE;
if (gdk_event_get_axis (event, GDK_AXIS_XTILT, &coords->xtilt))
coords->xtilt = CLAMP (coords->xtilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->xtilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_event_get_axis (event, GDK_AXIS_YTILT, &coords->ytilt))
coords->ytilt = CLAMP (coords->ytilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->ytilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_event_get_axis (event, GDK_AXIS_WHEEL, &coords->wheel))
coords->wheel = CLAMP (coords->wheel, GIMP_COORDS_MIN_WHEEL,
GIMP_COORDS_MAX_WHEEL);
- else
- coords->wheel = GIMP_COORDS_DEFAULT_WHEEL;
return TRUE;
}
@@ -92,6 +92,8 @@ gimp_display_shell_get_device_coords (GimpDisplayShell *shell,
{
gdouble axes[GDK_AXIS_LAST];
+ *coords = default_coords;
+
gdk_device_get_state (device, gtk_widget_get_window (shell->canvas),
axes, NULL);
@@ -99,33 +101,24 @@ gimp_display_shell_get_device_coords (GimpDisplayShell *shell,
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &coords->y);
/* CLAMP() the return value of each *_get_axis() call to be safe
- * against buggy XInput drivers. Provide default values if the
- * requested axis does not exist.
+ * against buggy XInput drivers.
*/
if (gdk_device_get_axis (device, axes, GDK_AXIS_PRESSURE, &coords->pressure))
coords->pressure = CLAMP (coords->pressure, GIMP_COORDS_MIN_PRESSURE,
GIMP_COORDS_MAX_PRESSURE);
- else
- coords->pressure = GIMP_COORDS_DEFAULT_PRESSURE;
if (gdk_device_get_axis (device, axes, GDK_AXIS_XTILT, &coords->xtilt))
coords->xtilt = CLAMP (coords->xtilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->xtilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_device_get_axis (device, axes, GDK_AXIS_YTILT, &coords->ytilt))
coords->ytilt = CLAMP (coords->ytilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->ytilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_device_get_axis (device, axes, GDK_AXIS_WHEEL, &coords->wheel))
coords->wheel = CLAMP (coords->wheel, GIMP_COORDS_MIN_WHEEL,
GIMP_COORDS_MAX_WHEEL);
- else
- coords->wheel = GIMP_COORDS_DEFAULT_WHEEL;
}
void
@@ -134,38 +127,31 @@ gimp_display_shell_get_time_coords (GimpDisplayShell *shell,
GdkTimeCoord *event,
GimpCoords *coords)
{
+ *coords = default_coords;
+
gdk_device_get_axis (device, event->axes, GDK_AXIS_X, &coords->x);
gdk_device_get_axis (device, event->axes, GDK_AXIS_Y, &coords->y);
/* CLAMP() the return value of each *_get_axis() call to be safe
- * against buggy XInput drivers. Provide default values if the
- * requested axis does not exist.
+ * against buggy XInput drivers.
*/
if (gdk_device_get_axis (device,
event->axes, GDK_AXIS_PRESSURE, &coords->pressure))
coords->pressure = CLAMP (coords->pressure, GIMP_COORDS_MIN_PRESSURE,
GIMP_COORDS_MAX_PRESSURE);
- else
- coords->pressure = GIMP_COORDS_DEFAULT_PRESSURE;
if (gdk_device_get_axis (device, event->axes, GDK_AXIS_XTILT, &coords->xtilt))
coords->xtilt = CLAMP (coords->xtilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->xtilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_device_get_axis (device, event->axes, GDK_AXIS_YTILT, &coords->ytilt))
coords->ytilt = CLAMP (coords->ytilt, GIMP_COORDS_MIN_TILT,
GIMP_COORDS_MAX_TILT);
- else
- coords->ytilt = GIMP_COORDS_DEFAULT_TILT;
if (gdk_device_get_axis (device, event->axes, GDK_AXIS_WHEEL, &coords->wheel))
coords->wheel = CLAMP (coords->wheel, GIMP_COORDS_MIN_WHEEL,
GIMP_COORDS_MAX_WHEEL);
- else
- coords->wheel = GIMP_COORDS_DEFAULT_WHEEL;
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]