diff options
Diffstat (limited to 'gtk/gtkclist.c')
-rw-r--r-- | gtk/gtkclist.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 0ab00b0abf..69cb38470c 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -2421,7 +2421,10 @@ set_cell_contents (GtkCList *clist, GdkBitmap *mask) { GtkRequisition requisition; - + gchar *old_text = NULL; + GdkPixmap *old_pixmap = NULL; + GdkBitmap *old_mask = NULL; + g_return_if_fail (clist != NULL); g_return_if_fail (GTK_IS_CLIST (clist)); g_return_if_fail (clist_row != NULL); @@ -2436,18 +2439,16 @@ set_cell_contents (GtkCList *clist, case GTK_CELL_EMPTY: break; case GTK_CELL_TEXT: - g_free (GTK_CELL_TEXT (clist_row->cell[column])->text); + old_text = GTK_CELL_TEXT (clist_row->cell[column])->text; break; case GTK_CELL_PIXMAP: - gdk_pixmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap); - if (GTK_CELL_PIXMAP (clist_row->cell[column])->mask) - gdk_bitmap_unref (GTK_CELL_PIXMAP (clist_row->cell[column])->mask); + old_pixmap = GTK_CELL_PIXMAP (clist_row->cell[column])->pixmap; + old_mask = GTK_CELL_PIXMAP (clist_row->cell[column])->mask; break; case GTK_CELL_PIXTEXT: - g_free (GTK_CELL_PIXTEXT (clist_row->cell[column])->text); - gdk_pixmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap); - if (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask) - gdk_bitmap_unref (GTK_CELL_PIXTEXT (clist_row->cell[column])->mask); + old_text = GTK_CELL_PIXTEXT (clist_row->cell[column])->text; + old_pixmap = GTK_CELL_PIXTEXT (clist_row->cell[column])->pixmap; + old_mask = GTK_CELL_PIXTEXT (clist_row->cell[column])->mask; break; case GTK_CELL_WIDGET: /* unimplimented */ @@ -2458,6 +2459,8 @@ set_cell_contents (GtkCList *clist, clist_row->cell[column].type = GTK_CELL_EMPTY; + /* Note that pixmap and mask were already ref'ed by the caller + */ switch (type) { case GTK_CELL_TEXT: @@ -2493,6 +2496,13 @@ set_cell_contents (GtkCList *clist, if (clist->column[column].auto_resize && !GTK_CLIST_AUTO_RESIZE_BLOCKED(clist)) column_auto_resize (clist, clist_row, column, requisition.width); + + if (old_text) + g_free (old_text); + if (old_pixmap) + gdk_pixmap_unref (old_pixmap); + if (old_mask) + gdk_pixmap_unref (old_mask); } PangoLayout * |