[banshee] LibraryWatcher: Catch and log exception when processing changes
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] LibraryWatcher: Catch and log exception when processing changes
- Date: Wed, 15 Feb 2012 19:35:59 +0000 (UTC)
commit 7f70949db5b51e4cb9ccb27f4b4dede07cb23466
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Wed Feb 15 20:30:10 2012 +0100
LibraryWatcher: Catch and log exception when processing changes
Any exception while processing file changes would lead to a crash, as
shown in bgo#666981. Catch those and log them as errors.
.../Banshee.LibraryWatcher/SourceWatcher.cs | 24 +++++++++++--------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs b/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
index 770721e..d827252 100644
--- a/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
+++ b/src/Extensions/Banshee.LibraryWatcher/Banshee.LibraryWatcher/SourceWatcher.cs
@@ -173,17 +173,21 @@ namespace Banshee.LibraryWatcher
Thread.Sleep (sleep);
}
- if (item.ChangeType == WatcherChangeTypes.Changed) {
- UpdateTrack (item.FullPath);
- } else if (item.ChangeType == WatcherChangeTypes.Created) {
- AddTrack (item.FullPath);
- } else if (item.ChangeType == WatcherChangeTypes.Deleted) {
- RemoveTrack (item.FullPath);
- } else if (item.ChangeType == WatcherChangeTypes.Renamed) {
- RenameTrack (item.OldFullPath, item.FullPath);
+ try {
+ if (item.ChangeType == WatcherChangeTypes.Changed) {
+ UpdateTrack (item.FullPath);
+ } else if (item.ChangeType == WatcherChangeTypes.Created) {
+ AddTrack (item.FullPath);
+ } else if (item.ChangeType == WatcherChangeTypes.Deleted) {
+ RemoveTrack (item.FullPath);
+ } else if (item.ChangeType == WatcherChangeTypes.Renamed) {
+ RenameTrack (item.OldFullPath, item.FullPath);
+ }
+
+ change_types |= item.ChangeType;
+ } catch (Exception e) {
+ Log.Error (String.Format ("Watcher: Error processing {0}", item.FullPath), e.Message, false);
}
-
- change_types |= item.ChangeType;
}
if ((change_types & WatcherChangeTypes.Deleted) > 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]