summaryrefslogtreecommitdiff
path: root/libslab/app-shell.c
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2018-12-30 17:38:53 +0800
committerraveit65 <[email protected]>2019-01-01 10:21:42 +0100
commit512b4468b3a029b1d9090f3b9d175aab05ae208b (patch)
tree50973db10d562ea78c6f03e872a390842b3bbdac /libslab/app-shell.c
parent99b0d3e8b5fb7c259918f2089b3132febeb99848 (diff)
downloadmate-control-center-512b4468b3a029b1d9090f3b9d175aab05ae208b.tar.bz2
mate-control-center-512b4468b3a029b1d9090f3b9d175aab05ae208b.tar.xz
Fixed crash when install/remove application.
Fixed issue #403 If m-c-c is open, install/uninstall application, m-c-c is crash.
Diffstat (limited to 'libslab/app-shell.c')
-rw-r--r--libslab/app-shell.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 05d5617e..ac846019 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -845,8 +845,17 @@ matemenu_tree_changed_callback (MateMenuTree * old_tree, gpointer user_data)
it's probably a good idea to wait a couple seconds to regenerate the categories in case there
are multiple quick changes being made, no sense regenerating multiple times.
*/
- g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 3000, (GSourceFunc) regenerate_categories,
- user_data, NULL);
+ GError *error = NULL;
+ AppShellData * app_data = user_data;
+ if (!matemenu_tree_load_sync (app_data->tree, &error)) {
+ g_warning ("Menu tree loading got error:%s\n", error->message);
+ g_object_unref (app_data->tree);
+ app_data->tree = NULL;
+ g_error_free (error);
+ } else {
+ g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 3000, (GSourceFunc) regenerate_categories,
+ user_data, NULL);
+ }
}
AppShellData *
@@ -887,10 +896,14 @@ generate_categories (AppShellData * app_data)
g_object_unref(app_data->tree);
app_data->tree = NULL;
}
-
}
- if ((root_dir = matemenu_tree_get_root_directory (app_data->tree)) == NULL ) {
+ if (app_data->tree != NULL)
+ root_dir = matemenu_tree_get_root_directory (app_data->tree);
+ else
+ root_dir = NULL;
+
+ if ( app_data->tree == NULL || root_dir == NULL) {
GtkWidget *dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Failure loading - %s",
app_data->menu_name);