[gnome-shell] Fix FTBFS and crash triggered by <AppSystem>.load_from_desktop_file()
- From: Siegfried-Angel Gevatter Pujals <sgevatter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Fix FTBFS and crash triggered by <AppSystem>.load_from_desktop_file()
- Date: Sun, 9 Aug 2009 15:42:38 +0000 (UTC)
commit 205c57d6af3913b3f98c239a43edaada38451348
Author: Siegfried-Angel Gevatter Pujals <rainct ubuntu com>
Date: Sun Aug 9 17:39:17 2009 +0200
Fix FTBFS and crash triggered by <AppSystem>.load_from_desktop_file()
- Avoid error '"iconname" may be used uninitialized in this function'
by initializing said variable to NULL.
- Define shell_util_get_file_description as static (like the other
similar functions) to avoid another compiler error.
- Don't save errors from g_key_file_load_from_data_dirs into the
variable "error" (ie. pass NULL to it instead). Without this,
gnome-shell crashes if the key file can't be found (with message
"Error invoking Shell.load_from_desktop_file: Valid key file could
not be found in search dirs").
- Check the result of the load_from_desktop_file() call in places.js,
as it may be null.
js/ui/places.js | 14 ++++++++------
src/shell-app-system.c | 4 ++--
src/shell-uri-util.c | 2 +-
3 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/places.js b/js/ui/places.js
index 8dcaf72..a5f814d 100644
--- a/js/ui/places.js
+++ b/js/ui/places.js
@@ -66,12 +66,14 @@ Places.prototype = {
this._menuBox.append(home.actor, Big.BoxPackFlags.NONE);
let networkApp = Shell.AppSystem.get_default().load_from_desktop_file('gnome-network-scheme.desktop');
- let networkIcon = networkApp.create_icon_texture(PLACES_ICON_SIZE);
- let network = new PlaceDisplay(networkApp.get_name(), networkIcon, Lang.bind(this, function () {
- Main.overlay.hide();
- networkApp.launch();
- }));
- this._menuBox.append(network.actor, Big.BoxPackFlags.NONE);
+ if (networkApp != null) {
+ let networkIcon = networkApp.create_icon_texture(PLACES_ICON_SIZE);
+ let network = new PlaceDisplay(networkApp.get_name(), networkIcon, Lang.bind(this, function () {
+ Main.overlay.hide();
+ networkApp.launch();
+ }));
+ this._menuBox.append(network.actor, Big.BoxPackFlags.NONE);
+ }
let connectIcon = Shell.TextureCache.get_default().load_icon_name("applications-internet", PLACES_ICON_SIZE);
let connect = new PlaceDisplay('Connect to...', connectIcon, Lang.bind(this, function () {
diff --git a/src/shell-app-system.c b/src/shell-app-system.c
index 3ac35b3..2cabeb5 100644
--- a/src/shell-app-system.c
+++ b/src/shell-app-system.c
@@ -652,7 +652,7 @@ shell_app_system_load_from_desktop_file (ShellAppSystem *system,
{
char *app_path = g_build_filename ("applications", filename, NULL);
success = g_key_file_load_from_data_dirs (keyfile, app_path, &full_path,
- G_KEY_FILE_NONE, error);
+ G_KEY_FILE_NONE, NULL);
g_free (app_path);
}
@@ -784,7 +784,7 @@ shell_app_info_get_desktop_file_path (ShellAppInfo *info)
GIcon *
shell_app_info_get_icon (ShellAppInfo *info)
{
- char *iconname;
+ char *iconname = NULL;
GIcon *icon;
/* This code adapted from gdesktopappinfo.c
diff --git a/src/shell-uri-util.c b/src/shell-uri-util.c
index 8419553..ccb9591 100644
--- a/src/shell-uri-util.c
+++ b/src/shell-uri-util.c
@@ -106,7 +106,7 @@ shell_util_get_file_display_for_common_files (GFile *file)
return NULL;
}
-char *
+static char *
shell_util_get_file_description (GFile *file)
{
GFileInfo *info;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]