With current dia CVS version and gtk/glib 1.2.0, I tried to copy &
paste a lifeline (UML object) and got the appended segmentation fault
(note that point is NULL!).

Looking at the implementation of lifeline I noticed a bug in
lifeline_copy.  After fixing this with the appended patch, copy &
pasting works for lifelines - even with .

Andreas

Program received signal SIGSEGV, Segmentation fault.
0x805912b in ddisplay_add_update_pixels (ddisp=0x80c13f8, point=0x0, 
    pixel_width=5, pixel_height=5) at ../../dia/app/display.c:204
204       rect.left = point->x - size_x/2.0;
(gdb) bt
#0  0x805912b in ddisplay_add_update_pixels (ddisp=0x80c13f8, point=0x0, 
    pixel_width=5, pixel_height=5) at ../../dia/app/display.c:204
#1  0x8053214 in diagram_add_update_pixels (dia=0x80b7eb8, point=0x0, 
    pixel_width=5, pixel_height=5) at ../../dia/app/diagram.c:322
#2  0x8052824 in connectionpoint_add_update (conpoint=0x0, dia=0x80b7eb8)
    at ../../dia/app/connectionpoint_ops.c:57
#3  0x805f30d in object_add_updates (obj=0x80d2688, dia=0x80b7eb8)
    at ../../dia/app/object_ops.c:40
#4  0x80530ec in diagram_add_selected (diagram=0x80b7eb8, obj=0x80d2688)
    at ../../dia/app/diagram.c:258
#5  0x8053119 in diagram_add_selected_list (dia=0x80b7eb8, list=0x80c6cd0)
    at ../../dia/app/diagram.c:268
#6  0x8054731 in edit_paste_callback (widget=0x0, data=0x0)
    at ../../dia/app/commands.c:488
#7  0x40081ee2 in gtk_item_factory_callback_marshal ()
#8  0x400d9efd in gtk_marshal_NONE__NONE ()
#9  0x400ad60d in gtk_handlers_run ()
#10 0x400acd42 in gtk_signal_real_emit ()
#11 0x400ab828 in gtk_signal_emit ()
#12 0x400d4358 in gtk_widget_activate ()
#13 0x4009132f in gtk_menu_shell_activate_item ()
#14 0x40090cab in gtk_menu_shell_button_release ()
#15 0x400d9ac9 in gtk_marshal_BOOL__POINTER ()
#16 0x400acd7b in gtk_signal_real_emit ()
#17 0x400ab828 in gtk_signal_emit ()
#18 0x400d4288 in gtk_widget_event ()
#19 0x4008c842 in gtk_propagate_event ()
#20 0x4008bc9a in gtk_main_do_event ()
#21 0x40104acb in gdk_event_dispatch ()
#22 0x4012ae26 in g_main_dispatch ()
#23 0x4012b331 in g_main_iterate ()
#24 0x4012b499 in g_main_run ()
#25 0x4008b6f9 in gtk_main ()
#26 0x805d1d5 in main (argc=2, argv=0xbffffb14) at ../../dia/app/main.c:30

1999-03-25  Andreas Jaeger  <[EMAIL PROTECTED]>

        * objects/UML/lifeline.c (lifeline_copy): Copy connections.

--- objects/UML/lifeline.c.~1~  Mon Mar 15 23:00:32 1999
+++ objects/UML/lifeline.c      Thu Mar 25 09:38:01 1999
@@ -1,5 +1,5 @@
 /* Dia -- an diagram creation/manipulation program
- * Copyright (C) 1998 Alexander Larsson
+ * Copyright (C) 1998, 1999 Alexander Larsson
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -344,6 +344,7 @@
 static Object *
 lifeline_copy(Lifeline *lifeline)
 {
+  int i;
   Lifeline *newlifeline;
   Connection *conn, *newconn;
   Object *newobj;
@@ -356,6 +357,14 @@
 
   connection_copy(conn, newconn);
 
+  for (i = 0; i < 6; i++) {
+    newobj->connections[i] = &newlifeline->connections[i];
+    newlifeline->connections[i].object = newobj;
+    newlifeline->connections[i].connected = NULL;
+    newlifeline->connections[i].pos = lifeline->connections[i].pos;
+    newlifeline->connections[i].last_pos = lifeline->connections[i].last_pos;
+  }
+
   newlifeline->boxbot_handle = lifeline->boxbot_handle;
   newobj->handles[2] = &newlifeline->boxbot_handle;
   newlifeline->boxtop_handle = lifeline->boxtop_handle;

-- 
 Andreas Jaeger   [EMAIL PROTECTED]    [EMAIL PROTECTED]
  for pgp-key finger [EMAIL PROTECTED]

Reply via email to