[banshee] [MassStorageSource] Fix crash when trying to delete a playlist
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [MassStorageSource] Fix crash when trying to delete a playlist
- Date: Sat, 27 Mar 2010 21:09:04 +0000 (UTC)
commit 4a6879f1da2dd06821bbfe3b38cb9b0b25e652d3
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sat Mar 27 22:06:26 2010 +0100
[MassStorageSource] Fix crash when trying to delete a playlist
Trying to delete an inacessible playlist to the device would cause a
crash. Fixes bgo#613734.
.../Banshee.Dap.MassStorage/MassStorageSource.cs | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
index aa48186..466e05b 100644
--- a/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
+++ b/src/Dap/Banshee.Dap.MassStorage/Banshee.Dap.MassStorage/MassStorageSource.cs
@@ -307,7 +307,11 @@ namespace Banshee.Dap.MassStorage
}
foreach (string file_name in PlaylistFiles) {
- Banshee.IO.File.Delete (new SafeUri (file_name));
+ try {
+ Banshee.IO.File.Delete (new SafeUri (file_name));
+ } catch (Exception e) {
+ Log.Exception (e);
+ }
}
// Add playlists from Banshee to the device
@@ -325,10 +329,16 @@ namespace Banshee.Dap.MassStorage
SafeUri playlist_path = new SafeUri (System.IO.Path.Combine (
PlaylistsPath, String.Format ("{0}.{1}", escaped_name, PlaylistTypes[0].FileExtension)));
- System.IO.Stream stream = Banshee.IO.File.OpenWrite (playlist_path, true);
- playlist_format.BaseUri = new Uri (BaseDirectory);
- playlist_format.Save (stream, from);
- stream.Close ();
+ System.IO.Stream stream = null;
+ try {
+ stream = Banshee.IO.File.OpenWrite (playlist_path, true);
+ playlist_format.BaseUri = new Uri (BaseDirectory);
+ playlist_format.Save (stream, from);
+ } catch (Exception e) {
+ Log.Exception (e);
+ } finally {
+ stream.Close ();
+ }
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]