Index: plugins/ipod/rb-ipod-db.c
===================================================================
--- plugins/ipod/rb-ipod-db.c	(revision 5757)
+++ plugins/ipod/rb-ipod-db.c	(working copy)
@@ -839,6 +839,31 @@
 	return NULL;
 }
 
+void
+rb_ipod_db_flush (RbIpodDb *db)
+{
+	RbIpodDbPrivate *priv = IPOD_DB_GET_PRIVATE (db);
+
+	if (priv->save_timeout_id != 0) {
+		rb_debug ("running schedules save immediately");
+		g_source_remove (priv->save_timeout_id);
+		priv->save_timeout_id = 0;
+
+		if (priv->saving_thread != NULL) {
+			/* wait for the current save to finish */
+			g_thread_join (priv->saving_thread);
+			priv->saving_thread = NULL;
+
+			/* then remove the cleanup idle it added */
+			g_source_remove (priv->save_idle_id);
+			ipod_db_saved_idle_cb (db);
+		}
+
+		/* do the save synchronously */
+		rb_itdb_save (db, NULL);
+	}
+}
+
 static gboolean
 save_timeout_cb (RbIpodDb *ipod_db)
 {
Index: plugins/ipod/rb-ipod-db.h
===================================================================
--- plugins/ipod/rb-ipod-db.h	(revision 5757)
+++ plugins/ipod/rb-ipod-db.h	(working copy)
@@ -58,6 +58,7 @@
 GType rb_ipod_db_get_type (void);
 
 void rb_ipod_db_save_async (RbIpodDb *db);
+void rb_ipod_db_flush (RbIpodDb *db);
 
 void rb_ipod_db_set_thumbnail (RbIpodDb* ipod_db, Itdb_Track *track, 
 			       GdkPixbuf *pixbuf);
Index: plugins/ipod/rb-ipod-source.c
===================================================================
--- plugins/ipod/rb-ipod-source.c	(revision 5757)
+++ plugins/ipod/rb-ipod-source.c	(working copy)
@@ -1656,8 +1656,8 @@
 		}
 	}
 
-        g_object_unref (G_OBJECT (priv->ipod_db));
-        priv->ipod_db = NULL;
+	/* force a db save */
+	rb_ipod_db_flush (priv->ipod_db);
 
 	RB_SOURCE_CLASS (rb_ipod_source_parent_class)->impl_delete_thyself (source);
 }
