summaryrefslogtreecommitdiff
path: root/graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2013-11-26 20:37:39 +0100
committerRobby Workman <rworkman@slackbuilds.org>2013-11-28 00:13:12 -0600
commitbce367d60b7d2b66b871120f6d7f944193fe71e4 (patch)
tree5744afae76874af3766d6678c67f44deb17b8c28 /graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch
parent114b7c7af8338af42bfce2efde7344c6e3e467b1 (diff)
downloadslackbuilds-bce367d60b7d2b66b871120f6d7f944193fe71e4.tar.gz
graphics/dia: Applied patches from upstream.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch')
-rw-r--r--graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch b/graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch
new file mode 100644
index 0000000000..59fe831dda
--- /dev/null
+++ b/graphics/dia/patches/0007-grid-object-avoid-crash-on-shrink.patch
@@ -0,0 +1,46 @@
+From ae8bcaa703197d090c0c746c54289ddcc6bbbbb1 Mon Sep 17 00:00:00 2001
+From: Hans Breuer <hans@breuer.org>
+Date: Thu, 7 Oct 2010 13:21:16 +0200
+Subject: [PATCH 07/24] grid-object: avoid crash on shrink
+
+Fix some confusion about rows/columns using the wrong limits.
+Resizing object::connections was too early.
+(cherry picked from commit cddd958b71a4075751ab76ac3530ced3c33972ea)
+---
+ objects/Misc/grid_object.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/objects/Misc/grid_object.c b/objects/Misc/grid_object.c
+index 05d1b16..11dca8b 100644
+--- a/objects/Misc/grid_object.c
++++ b/objects/Misc/grid_object.c
+@@ -460,12 +460,6 @@ grid_object_reallocate_cells (Grid_Object* grid_object)
+ if (old_rows == new_rows && old_cols == new_cols)
+ return; /* no reallocation necessary */
+
+- /* obj->connections doesn't own the pointers, so just realloc; values
+- * will be updated later */
+- obj->num_connections = GRID_OBJECT_BASE_CONNECTION_POINTS + new_rows*new_cols;
+- obj->connections = (ConnectionPoint **) g_realloc(obj->connections,
+- obj->num_connections * sizeof(ConnectionPoint *));
+-
+ /* If either new dimension is smaller, some connpoints will have to
+ * be disconnected before reallocating */
+
+@@ -485,6 +479,13 @@ grid_object_reallocate_cells (Grid_Object* grid_object)
+ object_remove_connections_to(&grid_object->cells[cell]);
+ }
+
++ /* must be done after disconnecting */
++ /* obj->connections doesn't own the pointers, so just realloc; values
++ * will be updated later */
++ obj->num_connections = GRID_OBJECT_BASE_CONNECTION_POINTS + new_rows*new_cols;
++ obj->connections = (ConnectionPoint **) g_realloc(obj->connections,
++ obj->num_connections * sizeof(ConnectionPoint *));
++
+ /* Can't use realloc; if grid has different dims, memory lays out
+ * differently. Must copy by hand. */
+
+--
+1.8.4.4
+