[dia] Fix recently observed crash with "UML - Component Feature"
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Fix recently observed crash with "UML - Component Feature"
- Date: Sun, 31 Aug 2014 18:17:52 +0000 (UTC)
commit c865c8b87e0cd774c75131d913ac53bfd156c69b
Author: Hans Breuer <hans breuer org>
Date: Sun Aug 31 19:48:10 2014 +0200
Fix recently observed crash with "UML - Component Feature"
found by make distcheck running test-objects and toggling the
auto-routing via object menu function plus reverting it.
gdb --args .libs/objects ../objects//
[...]
Starting program: [...]/dia/tests/.libs/objects ../objects//
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
/Dia/Objects/UML - Component Feature/Creation: OK
/Dia/Objects/UML - Component Feature/Copy: OK
/Dia/Objects/UML - Component Feature/Movement: OK
/Dia/Objects/UML - Component Feature/Change: OK
/Dia/Objects/UML - Component Feature/MoveHandle: OK
/Dia/Objects/UML - Component Feature/ConnectionPoints: OK
/Dia/Objects/UML - Component Feature/ObjectMenu: ***
Error in `[...]/dia/tests/.libs/objects': double free or corruption (fasttop): 0x0817b1d8 ***
Program received signal SIGABRT, Aborted.
0xb7fdd424 in __kernel_vsyscall ()
(gdb) bt
0 0xb7fdd424 in __kernel_vsyscall ()
1 0xb70dd577 in __GI_raise (sig=sig entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
2 0xb70e09a3 in __GI_abort () at abort.c:89
3 0xb71186e3 in __libc_message (do_abort=do_abort entry=1,
fmt=fmt entry=0xb72157bc "*** Error in `%s': %s: 0x%s ***\n")
at ../sysdeps/posix/libc_fatal.c:175
4 0xb7122bca in malloc_printerr (action=<optimized out>,
str=0xb7215980 "double free or corruption (fasttop)", ptr=0x817b1d8)
at malloc.c:4996
5 0xb712383d in _int_free (av=0xb725b420 <main_arena>, p=<optimized out>,
have_lock=0) at malloc.c:3840
6 0xb740bd30 in g_free (mem=0x817b1d8)
at /build/buildd/glib2.0-2.40.0/./glib/gmem.c:190
7 0xb7f8613b in orthconn_destroy (orth=0x8189f98) at orth_conn.c:582
8 0x0804aef8 in _test_object_menu (user_data=0xb6c99284 <compfeat_type>)
at test-objects.c:571
lib/orth_conn.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/lib/orth_conn.c b/lib/orth_conn.c
index 741c415..5c0956c 100644
--- a/lib/orth_conn.c
+++ b/lib/orth_conn.c
@@ -499,7 +499,13 @@ orthconn_init(OrthConn *orth, Point *startpoint)
orthconn_update_data(orth);
}
-/** This function does *not* set up handles */
+/*!
+ * \brief Change the points of the OrthConn
+ *
+ * This function used to *not* set up handles, but that
+ * was leaving the object in an inconsistent state especially
+ * when auto-routing changed the number of points
+ */
void
orthconn_set_points(OrthConn *orth, int num_points, Point *points)
{
@@ -528,6 +534,8 @@ orthconn_set_points(OrthConn *orth, int num_points, Point *points)
else orth->orientation[i] = VERTICAL;
horiz = !horiz;
}
+ /* keep the object sane regardless of it's previous comment */
+ adjust_handle_count_to (orth, orth->numpoints-1);
}
void
@@ -580,7 +588,7 @@ orthconn_destroy(OrthConn *orth)
for (i=0;i<orth->numpoints-1;i++)
g_free(orth->handles[i]);
-
+
g_free(orth->handles);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]