[gnumeric] ItemGrid: plug leak.



commit dae02e54aff9283bacee0b270b63fe455bdc15c6
Author: Morten Welinder <terra gnome org>
Date:   Wed Sep 16 10:45:40 2009 -0400

    ItemGrid: plug leak.

 ChangeLog       |    5 +++++
 src/item-bar.c  |    2 +-
 src/item-grid.c |   22 +++++++++++++++++++++-
 3 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2dae789..26e3f3b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-16  Morten Welinder  <terra gnome org>
+
+	* src/item-grid.c (item_grid_unrealize): New function to plug
+	leak.
+
 2009-09-15  Jean Brefort  <jean brefort normalesup org>
 
 	* src/item-cursor.c (item_cursor_button2_pressed),
diff --git a/src/item-bar.c b/src/item-bar.c
index 134b0dd..1d3713e 100644
--- a/src/item-bar.c
+++ b/src/item-bar.c
@@ -334,7 +334,7 @@ item_bar_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
 		int const inc = item_bar_group_size (ib, sheet->cols.max_outline_level);
 		int const base_pos = .2 * inc;
 		int const len = (inc > 4) ? 4 : inc;
-		int end, total, col = pane->first.col;// = 0;
+		int end, total, col = pane->first.col;
 		gboolean const char_label = !sheet->convs->r1c1_addresses;
 
 		/* shadow type selection must be keep in sync with code in ib_draw_cell */
diff --git a/src/item-grid.c b/src/item-grid.c
index f0906a8..5d25664 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -164,7 +164,7 @@ item_grid_realize (GocItem *item)
 	ItemGrid   *ig;
 
 	if (parent_class->realize)
-		(*parent_class->realize) (item);
+		parent_class->realize (item);
 
 	ig = ITEM_GRID (item);
 
@@ -177,6 +177,25 @@ item_grid_realize (GocItem *item)
 }
 
 static void
+item_grid_unrealize (GocItem *item)
+{
+	ItemGrid *ig = ITEM_GRID (item);
+
+	if (ig->cursor_link) {
+		gdk_cursor_unref (ig->cursor_link);
+		ig->cursor_link = NULL;
+	}
+
+	if (ig->cursor_cross) {
+		gdk_cursor_unref (ig->cursor_cross);
+		ig->cursor_cross = NULL;
+	}
+
+	if (parent_class->unrealize)
+		parent_class->unrealize (item);
+}
+
+static void
 item_grid_update_bounds (GocItem *item)
 {
 	item->x0 = 0;
@@ -1135,6 +1154,7 @@ item_grid_class_init (GObjectClass *gobject_klass)
 			GSF_PARAM_STATIC | G_PARAM_WRITABLE));
 
 	item_klass->realize     = item_grid_realize;
+	item_klass->unrealize     = item_grid_unrealize;
 	item_klass->draw_region     = item_grid_draw_region;
 	item_klass->update_bounds   = item_grid_update_bounds;
 	item_klass->button_pressed  = item_grid_button_pressed;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]