[rhythmbox] artsearch: fix fd leak by closing enumerators explicitly
- From: Jonathan Matthew <jmatthew src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [rhythmbox] artsearch: fix fd leak by closing enumerators explicitly
 
- Date: Thu,  4 Oct 2012 09:39:25 +0000 (UTC)
 
commit 72906495ec4728fd10582f00213755e509d131bc
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Oct 3 21:12:00 2012 +1000
    artsearch: fix fd leak by closing enumerators explicitly
 plugins/artsearch/local.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/artsearch/local.py b/plugins/artsearch/local.py
index ce1e798..dfbf6b6 100644
--- a/plugins/artsearch/local.py
+++ b/plugins/artsearch/local.py
@@ -92,11 +92,19 @@ class LocalSearch:
 
 		self.callback(self.callback_args)
 
+	def _close_enum_cb(self, fileenum, result, results):
+		try:
+			fileenum.close_finish(result)
+		except Exception, e:
+			print "couldn't close file enumerator: %s" % e
+		
+
 	def _enum_dir_cb(self, fileenum, result, results):
 		try:
 			files = fileenum.next_files_finish(result)
 			if files is None or len(files) == 0:
 				print "okay, done; got %d files" % len(results)
+				fileenum.close_async(GLib.PRIORITY_DEFAULT, None, self._close_enum_cb, None)
 				self.finished(results)
 				return
 
@@ -115,6 +123,7 @@ class LocalSearch:
 			import sys
 			sys.excepthook(*sys.exc_info())
 			self.finished(results)
+			fileenum.close_async(GLib.PRIORITY_DEFAULT, None, self._close_enum_cb, None)
 
 
 	def _enum_children_cb(self, parent, result, data):
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]