dia r3930 - in trunk: . lib
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r3930 - in trunk: . lib
- Date: Tue, 8 Apr 2008 22:33:10 +0100 (BST)
Author: hans
Date: Tue Apr 8 22:33:09 2008
New Revision: 3930
URL: http://svn.gnome.org/viewvc/dia?rev=3930&view=rev
Log:
2008-04-08 Hans Breuer <hans breuer org>
* lib/object.c(object_copy_list) : if we can't find the object to
to connect to ensure there is no dangling reference. Fixes bug #497070
* lib/group.c(group_copy) : some comment
* lib/font.c(dia_font_string_width) : no need to create multiple
TextLines to calculate the length of an empty string.
* lib/text.c(text_key_event) : no text change for modifiers
Modified:
trunk/ChangeLog
trunk/lib/font.c
trunk/lib/group.c
trunk/lib/object.c
trunk/lib/text.c
Modified: trunk/lib/font.c
==============================================================================
--- trunk/lib/font.c (original)
+++ trunk/lib/font.c Tue Apr 8 22:33:09 2008
@@ -541,9 +541,12 @@
real
dia_font_string_width(const char* string, DiaFont *font, real height)
{
- TextLine *text_line = text_line_new(string, font, height);
- real result = text_line_get_width(text_line);
- text_line_destroy(text_line);
+ real result = 0;
+ if (string && *string) {
+ TextLine *text_line = text_line_new(string, font, height);
+ result = text_line_get_width(text_line);
+ text_line_destroy(text_line);
+ }
return result;
}
Modified: trunk/lib/group.c
==============================================================================
--- trunk/lib/group.c (original)
+++ trunk/lib/group.c Tue Apr 8 22:33:09 2008
@@ -215,7 +215,7 @@
group_destroy(Group *group)
{
DiaObject *obj = &group->object;
-
+
destroy_object_list(group->objects);
/* ConnectionPoints in the inner objects have already
@@ -258,6 +258,7 @@
listobj = (DiaObject *) list->data;
for (i=0;i<listobj->num_connections;i++) {
+ /* Make connectionpoints be that of the 'inner' objects: */
newobj->connections[num_conn++] = listobj->connections[i];
}
Modified: trunk/lib/object.c
==============================================================================
--- trunk/lib/object.c (original)
+++ trunk/lib/object.c Tue Apr 8 22:33:09 2008
@@ -202,9 +202,21 @@
other_obj = con_point->object;
other_obj_copy = g_hash_table_lookup(hash_table, other_obj);
- if (other_obj_copy == NULL)
+ if (other_obj_copy == NULL) {
+ /* Ensure we have no dangling connection to avoid crashing, on
+ * object_unconnect() e.g. bug #497070. Two questions remaining:
+ * - shouldn't the object::copy() have initialized this to NULL?
+ * - could we completely solve this by looking deeper into groups?
+ * The sample from #497070 has nested groups but this function currently
+ * works on one level at the time. Thus the object within the group are
+ * invisible when we try to restore the groups connectons. BUT the
+ * connectionpoints in the group are shared with the connectionpoints
+ * of the inner objects ...
+ */
+ obj_copy->handles[i]->connected_to = NULL;
break; /* other object was not on list. */
-
+ }
+
con_point_nr=0;
while (other_obj->connections[con_point_nr] != con_point) {
con_point_nr++;
Modified: trunk/lib/text.c
==============================================================================
--- trunk/lib/text.c (original)
+++ trunk/lib/text.c Tue Apr 8 22:33:09 2008
@@ -902,6 +902,16 @@
text->cursor_pos, text->cursor_row);
text_split_line(text);
break;
+ case GDK_Shift_L:
+ case GDK_Shift_R:
+ case GDK_Control_L:
+ case GDK_Control_R:
+ case GDK_Alt_L:
+ case GDK_Alt_R:
+ case GDK_Meta_L:
+ case GDK_Meta_R:
+ return_val = FALSE; /* no text change for modifiers */
+ break;
default:
if (str || (strlen>0)) {
return_val = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]