From 875bbe6acb379addef064f014030d349539bdbe4 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 31 Aug 2018 12:48:00 -0400
Subject: [PATCH 2/4] objectManager: correct other invalid index code in
onNameVanished
The object manager tries to synthesize interface removal
events if the bus name of a remote object drops off the bus.
The code had bad typos in it, though: it reuses the `i`
index variable in its inner loop, where it should be using
the `j` index variable.
This commit corrects the i/j confusion.
---
js/misc/objectManager.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/js/misc/objectManager.js b/js/misc/objectManager.js
index 5dffaa130..1442e3df8 100644
--- a/js/misc/objectManager.js
+++ b/js/misc/objectManager.js
@@ -213,62 +213,62 @@ var ObjectManager = new Lang.Class({
return;
}
let objectPaths = Object.keys(objects);
for (let i = 0; i < objectPaths.length; i++) {
let objectPath = objectPaths[i];
let object = objects[objectPath];
let interfaceNames = Object.getOwnPropertyNames(object);
for (let j = 0; j < interfaceNames.length; j++) {
let interfaceName = interfaceNames[j];
// Prevent load from completing until the interface is loaded
this._numLoadInhibitors++;
this._addInterface(objectPath,
interfaceName,
this._tryToCompleteLoad.bind(this));
}
}
this._tryToCompleteLoad();
});
},
_onNameVanished() {
let objectPaths = Object.keys(this._objects);
for (let i = 0; i < objectPaths.length; i++) {
let objectPath = objectPaths[i];
let object = this._objects[objectPath];
let interfaceNames = Object.keys(object);
- for (let j = 0; i < interfaceNames.length; i++) {
- let interfaceName = interfaceNames[i];
+ for (let j = 0; j < interfaceNames.length; j++) {
+ let interfaceName = interfaceNames[j];
if (object[interfaceName])
this._removeInterface(objectPath, interfaceName);
}
}
},
_registerInterfaces(interfaces) {
for (let i = 0; i < interfaces.length; i++) {
let info = Gio.DBusInterfaceInfo.new_for_xml(interfaces[i]);
this._interfaceInfos[info.name] = info;
}
},
getProxy(objectPath, interfaceName) {
let object = this._objects[objectPath];
if (!object)
return null;
return object[interfaceName];
},
getProxiesForInterface(interfaceName) {
let proxyList = this._interfaces[interfaceName];
if (!proxyList)
return [];
return proxyList;
--
2.21.0