summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-03-01 17:14:45 +0300
committermonsta <[email protected]>2016-03-21 15:41:14 +0300
commitdffd8927a2aed0cc1fe491aea2c7162abad0ae2d (patch)
treeefd0121553b201c0a2f3dfba2e304574ef5c2fe9
parent359dade1fb01ca371eee6f5302cfa0704aa0ad2b (diff)
downloadmate-system-monitor-dffd8927a2aed0cc1fe491aea2c7162abad0ae2d.tar.bz2
mate-system-monitor-dffd8927a2aed0cc1fe491aea2c7162abad0ae2d.tar.xz
fix segfault on view mode change with process properties open
from https://git.gnome.org/browse/gnome-system-monitor/commit/?id=76545e553c620d9b3437456bb4dbffa355c59816
-rw-r--r--src/openfiles.cpp5
-rw-r--r--src/procproperties.cpp11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/openfiles.cpp b/src/openfiles.cpp
index 2c3020c..ff1466d 100644
--- a/src/openfiles.cpp
+++ b/src/openfiles.cpp
@@ -174,7 +174,8 @@ update_openfiles_dialog (GtkWidget *tree)
GHashTable *new_maps;
guint i;
- info = static_cast<ProcInfo*>(g_object_get_data (G_OBJECT (tree), "selected_info"));
+ pid_t pid = GPOINTER_TO_UINT(static_cast<pid_t*>(g_object_get_data (G_OBJECT (tree), "selected_info")));
+ info = ProcInfo::find(pid);
if (!info)
return;
@@ -371,7 +372,7 @@ create_single_openfiles_dialog (GtkTreeModel *model, GtkTreePath *path,
tree = create_openfiles_tree (procdata);
gtk_container_add (GTK_CONTAINER (scrolled), tree);
- g_object_set_data (G_OBJECT (tree), "selected_info", info);
+ g_object_set_data (G_OBJECT (tree), "selected_info", GUINT_TO_POINTER (info->pid));
g_object_set_data (G_OBJECT (tree), "settings", procdata->settings);
gtk_box_pack_start (GTK_BOX (dialog_vbox), scrolled, TRUE, TRUE, 0);
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index 26861ec..7d255ab 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -112,6 +112,9 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
guint i;
GtkListStore *store;
+ if (!info)
+ return;
+
get_process_memory_info(info);
#if defined (__NetBSD__) || defined (__OpenBSD__)
@@ -167,10 +170,8 @@ update_procproperties_dialog (GtkWidget *tree)
{
ProcInfo *info;
- info = static_cast<ProcInfo*>(g_object_get_data (G_OBJECT (tree), "selected_info"));
-
- if (!info)
- return;
+ pid_t pid = GPOINTER_TO_UINT(static_cast<pid_t*>(g_object_get_data (G_OBJECT (tree), "selected_info")));
+ info = ProcInfo::find(pid);
fill_proc_properties(tree, info);
}
@@ -290,7 +291,7 @@ create_single_procproperties_dialog (GtkTreeModel *model, GtkTreePath *path,
tree = create_procproperties_tree (procdata);
gtk_container_add (GTK_CONTAINER (scrolled), tree);
- g_object_set_data (G_OBJECT (tree), "selected_info", info);
+ g_object_set_data (G_OBJECT (tree), "selected_info", GUINT_TO_POINTER (info->pid));
gtk_box_pack_start (GTK_BOX (dialog_vbox), scrolled, TRUE, TRUE, 0);
gtk_widget_show_all (scrolled);