Fix occasional crash in lists handling in ShellAppMonitor
We need to reset the popularity GSList* at start, and everytime we load data about a another activity. This also implies fixing the typo about (activity != -1). Thanks to Dan Winship. http://bugzilla.gnome.org/show_bug.cgi?id=582215
This commit is contained in:
parent
675fe56176
commit
bea595d143
@ -889,7 +889,7 @@ static void
|
||||
restore_from_file (ShellAppMonitor *monitor)
|
||||
{
|
||||
int activity = -1; /* Means invalid ID */
|
||||
GSList *popularity;
|
||||
GSList *popularity = NULL;
|
||||
AppPopularity *app_popularity;
|
||||
GFileInputStream *input;
|
||||
GDataInputStream *data_input;
|
||||
@ -927,6 +927,7 @@ restore_from_file (ShellAppMonitor *monitor)
|
||||
popularity = g_slist_sort (popularity, popularity_sort_apps);
|
||||
g_hash_table_replace (monitor->popularities,
|
||||
GINT_TO_POINTER (activity), popularity);
|
||||
popularity = NULL;
|
||||
}
|
||||
activity = atoi (line);
|
||||
/* FIXME: do something if conversion fails! */
|
||||
@ -942,7 +943,7 @@ restore_from_file (ShellAppMonitor *monitor)
|
||||
}
|
||||
/* Line is about an app.
|
||||
* If no activity was provided yet, just skip */
|
||||
else if ((activity != 1) && (strcmp (line, "") != 0))
|
||||
else if ((activity != -1) && (strcmp (line, "") != 0))
|
||||
{
|
||||
info = g_strsplit (line, ",", 0);
|
||||
if (info[0] && info [1] && info[2]) /* Skip on wrong syntax */
|
||||
|
Loading…
Reference in New Issue
Block a user