[gnome-shell] Fix crash in runDialog
- From: Florian Müllner <fmuellner src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Fix crash in runDialog
- Date: Sat, 19 Dec 2009 23:36:50 +0000 (UTC)
commit ed2e0645ee9155cd8f2a861991b88acc931fd502
Author: Florian Müllner <fmuellner src gnome org>
Date: Fri Dec 18 23:21:04 2009 +0100
Fix crash in runDialog
The run dialog crashes when PATH contains non-existing directories (some
distros seem to do that ...).
Fix by filtering those out before setting up file monitors.
https://bugzilla.gnome.org/show_bug.cgi?id=604958
js/ui/runDialog.js | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js
index 6f98738..791e5de 100644
--- a/js/ui/runDialog.js
+++ b/js/ui/runDialog.js
@@ -34,24 +34,34 @@ function CommandCompleter() {
CommandCompleter.prototype = {
_init : function() {
this._changedCount = 0;
- this._paths = GLib.getenv('PATH').split(':');
this._valid = false;
this._updateInProgress = false;
- this._childs = new Array(this._paths.length);
- this._monitors = new Array(this._paths.length);
- for (let i = 0; i < this._paths.length; i++) {
- this._childs[i] = [];
- let file = Gio.file_new_for_path(this._paths[i]);
- let info = file.query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE, Gio.FileQueryInfoFlags.NONE, null);
+ this._paths = new Array();
+ this._childs = new Array();
+ this._monitors = new Array();
+
+ let _paths = GLib.getenv('PATH').split(':');
+ for (let i in _paths) {
+ let file = Gio.file_new_for_path(_paths[i]);
+
+ if (! file.query_exists(null))
+ continue;
+
+ let info = file.query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE,
+ Gio.FileQueryInfoFlags.NONE, null);
if (info.get_attribute_uint32(Gio.FILE_ATTRIBUTE_STANDARD_TYPE) != Gio.FileType.DIRECTORY)
continue;
- this._paths[i] = file.get_path();
- this._monitors[i] = file.monitor_directory(Gio.FileMonitorFlags.NONE, null);
- if (this._monitors[i] != null) {
- this._monitors[i].connect("changed", Lang.bind(this, this._onChanged));
- }
+ let monitor = file.monitor_directory(Gio.FileMonitorFlags.NONE,
+ null);
+
+ this._childs.push([]);
+ this._paths.push(file.get_path());
+ this._monitors.push(monitor);
+
+ if (monitor)
+ monitor.connect("changed", Lang.bind(this, this._onChanged));
}
this._update(0);
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]