[banshee] [gio] Prevent "Too many open files" exception
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [gio] Prevent "Too many open files" exception
- Date: Wed, 17 Mar 2010 20:10:24 +0000 (UTC)
commit 9138232e42d8fd033ebc0de355e64b5653a23efc
Author: Gabriel Burt <gabriel burt gmail com>
Date: Wed Mar 17 13:08:47 2010 -0700
[gio] Prevent "Too many open files" exception
Dispose FileInfos while enumerating directories' files
.../Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs | 10 +++++++++-
.../Banshee.Gio/Banshee.IO.Gio/Directory.cs | 2 ++
2 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs b/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
index 6dd7142..beebca5 100644
--- a/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
+++ b/src/Backends/Banshee.Gio/Banshee.IO.Gio/DemuxVfs.cs
@@ -33,7 +33,7 @@ using Banshee.Base;
namespace Banshee.IO.Gio
{
- public class DemuxVfs : IDemuxVfs
+ public class DemuxVfs : IDemuxVfs, IDisposable
{
private GLib.File file;
private GLib.FileInfo file_info;
@@ -47,6 +47,14 @@ namespace Banshee.IO.Gio
}
}
+ public void Dispose ()
+ {
+ if (file_info != null) {
+ file_info.Dispose ();
+ file_info = null;
+ }
+ }
+
public void CloseStream (System.IO.Stream stream)
{
stream.Close ();
diff --git a/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs b/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
index 0f12bcd..bff49d4 100644
--- a/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
+++ b/src/Backends/Banshee.Gio/Banshee.IO.Gio/Directory.cs
@@ -121,6 +121,7 @@ namespace Banshee.IO.Gio
if ((file.FileType & FileType.Regular) != 0) {
yield return dir.Uri.AbsoluteUri + "/" + Uri.EscapeDataString (file.Name);
}
+ file.Dispose ();
}
}
@@ -135,6 +136,7 @@ namespace Banshee.IO.Gio
if ((file.FileType & FileType.Directory) != 0) {
yield return dir.Uri.AbsoluteUri + "/" + Uri.EscapeDataString (file.Name);
}
+ file.Dispose ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]