[gnome-ostree] Add missing calls to Gio.FileEnumerator.close()



commit 0f61ce0bd677acf28e457cac103843858d2cdb36
Author: Colin Walters <walters verbum org>
Date:   Mon Apr 29 14:12:35 2013 -0400

    Add missing calls to Gio.FileEnumerator.close()
    
    Otherwise we leak descriptors, and that causes crashes quickly.

 src/js/jsondb.js           |    4 +++-
 src/js/tasks/task-build.js |    2 ++
 2 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/js/jsondb.js b/src/js/jsondb.js
index 71013da..79867e3 100644
--- a/src/js/jsondb.js
+++ b/src/js/jsondb.js
@@ -46,8 +46,9 @@ const JsonDB = new Lang.Class({
     },
 
     _getAll: function() {
+       let cancellable = null;
        var result = [];
-       var e = this._path.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, null);
+       var e = this._path.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NONE, cancellable);
        let info;
        while ((info = e.next_file(null)) != null) {
            let name = info.get_name();
@@ -57,6 +58,7 @@ const JsonDB = new Lang.Class({
            result.push([parseInt(match[1]), parseInt(match[2]),
                         match[3], name]);
        }
+       e.close(cancellable);
        result.sort(function(a, b) {
            var aMajor = a[0]; var bMajor = b[0];
            var aMinor = a[1]; var bMinor = b[1];
diff --git a/src/js/tasks/task-build.js b/src/js/tasks/task-build.js
index 79d33c8..25bc577 100644
--- a/src/js/tasks/task-build.js
+++ b/src/js/tasks/task-build.js
@@ -71,6 +71,7 @@ const TaskBuild = new Lang.Class({
             print("Removing old cached buildroot " + child.get_path());
             GSystem.shutil_rm_rf(child, cancellable);
        }
+       direnum.close(cancellable);
     },
 
     _composeBuildrootCore: function(workdir, componentName, architecture, rootContents, cancellable) {
@@ -774,6 +775,7 @@ const TaskBuild = new Lang.Class({
            kernelPath = e.get_child(info);
            break;
        }
+       e.close(cancellable);
        if (kernelPath === null)
            throw new Error("Couldn't find vmlinuz- in compose root");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]