Fix cursor display in register window

Didier Vidal didier-devel at 9online.fr
Sun Oct 2 11:57:37 EDT 2005


The function  gnc_item_edit_draw_info returned a PangoRectangle for the
cursor, that was allocated on the heap. This led to random behaviours.
The patch makes a copy of the rectangle in the TextDrawInfo structure.

Didier Vidal.

 cvs -q diff -u gnucash-item-edit.c
Index: gnucash-item-edit.c
===================================================================
RCS file:
/home/cvs/cvsroot/gnucash/src/register/register-gnome/gnucash-item-edit.c,v
retrieving revision 1.1.6.12
diff -u -r1.1.6.12 gnucash-item-edit.c
--- gnucash-item-edit.c 15 Aug 2005 23:34:38 -0000      1.1.6.12
+++ gnucash-item-edit.c 2 Oct 2005 15:52:55 -0000
@@ -80,7 +80,7 @@
  
         gboolean hatching;
  
-       PangoRectangle *cursor;
+       PangoRectangle cursor;
 };
  
  
@@ -226,7 +226,7 @@
        }
  
        pango_layout_get_cursor_pos (info->layout, cursor_pos, NULL,
&strong_pos);
-       info->cursor = &strong_pos;
+       info->cursor = strong_pos;
  
         if (info->hatching)
         {
@@ -289,10 +289,10 @@
  
         gdk_draw_line (drawable,
                        item_edit->gc,
-                       PANGO_PIXELS (info.cursor->x) + CELL_HPADDING,
-                       PANGO_PIXELS (info.cursor->y),
-                       PANGO_PIXELS (info.cursor->x) + CELL_HPADDING,
-                       PANGO_PIXELS (info.cursor->y +
info.cursor->height));
+                       PANGO_PIXELS (info.cursor.x) + CELL_HPADDING,
+                       PANGO_PIXELS (info.cursor.y),
+                       PANGO_PIXELS (info.cursor.x) + CELL_HPADDING,
+                       PANGO_PIXELS (info.cursor.y +
info.cursor.height));
  
         gdk_gc_set_clip_rectangle (item_edit->gc, NULL);
  




More information about the gnucash-patches mailing list