Index: sources/rb-playlist-source.c
===================================================================
--- sources/rb-playlist-source.c	(revision 5055)
+++ sources/rb-playlist-source.c	(working copy)
@@ -271,7 +271,7 @@
 							 rb_playlist_source_track_cell_data_func,
 							 source, NULL);
 		rb_entry_view_insert_column_custom (source->priv->songs, column, title,
-						    "PlaylistTrack", NULL, 0, 0);
+						    "PlaylistTrack", NULL, 0, NULL, 0);
 	}
 
 	rb_entry_view_append_column (source->priv->songs, RB_ENTRY_VIEW_COL_TRACK_NUMBER, FALSE);
Index: sources/rb-play-queue-source.c
===================================================================
--- sources/rb-play-queue-source.c	(revision 5055)
+++ sources/rb-play-queue-source.c	(working copy)
@@ -201,7 +201,7 @@
 						 rb_play_queue_source_track_info_cell_data_func,
 						 source, NULL);
 	rb_entry_view_append_column_custom (priv->sidebar, priv->sidebar_column,
-					    _("Play Queue"), "Title", NULL, 0);
+					    _("Play Queue"), "Title", NULL, 0, NULL);
 	rb_entry_view_set_columns_clickable (priv->sidebar, FALSE);
 	rb_playlist_source_setup_entry_view (RB_PLAYLIST_SOURCE (source), priv->sidebar);
 
Index: sources/rb-podcast-source.c
===================================================================
--- sources/rb-podcast-source.c	(revision 5055)
+++ sources/rb-podcast-source.c	(working copy)
@@ -600,7 +600,7 @@
 
 	rb_entry_view_append_column_custom (source->priv->posts, column,
 					    _("Date"), "Date",
-					    (GCompareDataFunc) rb_podcast_source_post_date_cell_sort_func, 0);
+					    (GCompareDataFunc) rb_podcast_source_post_date_cell_sort_func, 0, NULL);
 
 	rb_entry_view_append_column (source->priv->posts, RB_ENTRY_VIEW_COL_TITLE, TRUE);
 
@@ -621,7 +621,7 @@
 
 	rb_entry_view_append_column_custom (source->priv->posts, column,
 					    _("Feed"), "Feed",
-					    (GCompareDataFunc) rb_podcast_source_post_feed_cell_sort_func, 0);
+					    (GCompareDataFunc) rb_podcast_source_post_feed_cell_sort_func, 0, NULL);
 
 	rb_entry_view_append_column (source->priv->posts, RB_ENTRY_VIEW_COL_DURATION, FALSE);
 	rb_entry_view_append_column (source->priv->posts, RB_ENTRY_VIEW_COL_RATING, FALSE);
@@ -658,7 +658,7 @@
 
 	rb_entry_view_append_column_custom (source->priv->posts, column,
 					    _("Status"), "Status",
-					    (GCompareDataFunc) rb_podcast_source_post_status_cell_sort_func, 0);
+					    (GCompareDataFunc) rb_podcast_source_post_status_cell_sort_func, 0, NULL);
 
 	g_signal_connect_object (G_OBJECT (source->priv->posts),
 				 "sort-order-changed",
Index: widgets/rb-entry-view.c
===================================================================
--- widgets/rb-entry-view.c	(revision 5055)
+++ widgets/rb-entry-view.c	(working copy)
@@ -55,6 +55,7 @@
 {
 	GCompareDataFunc func;
 	gpointer data;
+	GDestroyNotify data_destroy;
 };
 
 static void rb_entry_view_class_init (RBEntryViewClass *klass);
@@ -63,6 +64,9 @@
 					   GObjectConstructParam *construct_properties);
 static void rb_entry_view_dispose (GObject *object);
 static void rb_entry_view_finalize (GObject *object);
+static void rb_entry_view_sort_data_finalize (gpointer column,
+					      gpointer sort_data,
+					      gpointer user_data);
 static void rb_entry_view_set_property (GObject *object,
 				       guint prop_id,
 				       const GValue *value,
@@ -466,6 +470,8 @@
 	g_return_if_fail (view->priv != NULL);
 
 	g_hash_table_destroy (view->priv->propid_column_map);
+	g_hash_table_foreach (view->priv->column_sort_data_map,
+			      rb_entry_view_sort_data_finalize, NULL);
 	g_hash_table_destroy (view->priv->column_sort_data_map);
 	g_hash_table_destroy (view->priv->column_key_map);
 
@@ -476,6 +482,22 @@
 }
 
 static void
+rb_entry_view_sort_data_finalize (gpointer column,
+				  gpointer gsort_data,
+				  gpointer user_data)
+{
+	struct RBEntryViewColumnSortData *sort_data = gsort_data;
+
+	if (sort_data->data_destroy) {
+		sort_data->data_destroy (sort_data->data);
+
+		sort_data->data_destroy = NULL;
+		sort_data->data = NULL;
+		sort_data->func = NULL;
+	}
+}
+
+static void
 rb_entry_view_set_shell_player_internal (RBEntryView   *view,
 					 RBShellPlayer *player)
 {
@@ -1279,7 +1301,7 @@
 
 	g_hash_table_insert (view->priv->propid_column_map, GINT_TO_POINTER (propid), column);
 
-	rb_entry_view_append_column_custom (view, column, title, key, sort_func, GINT_TO_POINTER (sort_propid));
+	rb_entry_view_append_column_custom (view, column, title, key, sort_func, GINT_TO_POINTER (sort_propid), NULL);
 }
 
 void
@@ -1288,9 +1310,10 @@
 				    const char *title,
 				    const char *key,
 				    GCompareDataFunc sort_func,
-				    gpointer data)
+				    gpointer data,
+				    GDestroyNotify data_destroy)
 {
-	rb_entry_view_insert_column_custom (view, column, title, key, sort_func, data, -1);
+	rb_entry_view_insert_column_custom (view, column, title, key, sort_func, data, data_destroy, -1);
 }
 
 void
@@ -1300,6 +1323,7 @@
 				    const char *key,
 				    GCompareDataFunc sort_func,
 				    gpointer data,
+				    GDestroyNotify data_destroy,
 				    gint position)
 {
 	struct RBEntryViewColumnSortData *sortdata;
@@ -1322,6 +1346,7 @@
 		sortdata = g_new (struct RBEntryViewColumnSortData, 1);
 		sortdata->func = (GCompareDataFunc) sort_func;
 		sortdata->data = data;
+		sortdata->data_destroy = data_destroy;
 		g_hash_table_insert (view->priv->column_sort_data_map, column, sortdata);
 	}
 	g_hash_table_insert (view->priv->column_key_map, g_strdup (key), column);
@@ -2099,7 +2124,7 @@
 	rhythmdb_query_model_set_sort_order (view->priv->model,
 					     sort_data->func,
 					     sort_data->data,
-					     NULL,
+					     sort_data->data_destroy,
 					     (view->priv->sorting_order == GTK_SORT_DESCENDING));
 }
 
Index: widgets/rb-entry-view.h
===================================================================
--- widgets/rb-entry-view.h	(revision 5055)
+++ widgets/rb-entry-view.h	(working copy)
@@ -113,7 +113,8 @@
 							 const char *title,
                                                          const char *key,
 							 GCompareDataFunc sort_func,
-							 gpointer data);
+							 gpointer data,
+							 GDestroyNotify data_destroy);
 
 void		rb_entry_view_insert_column_custom	(RBEntryView *view,
                                                          GtkTreeViewColumn *column,
@@ -121,6 +122,7 @@
                                                          const char *key,
 							 GCompareDataFunc sort_func,
 							 gpointer data,
+							 GDestroyNotify data_destroy,
 							 gint position);
 
 void		rb_entry_view_set_columns_clickable	(RBEntryView *view,
