Commit f39e0cb8 authored by Igor's avatar Igor

Fix memory leaks in Privacy Dialog

parent ba198f45
...@@ -4470,15 +4470,16 @@ cb_rstto_main_window_clear_private_data ( ...@@ -4470,15 +4470,16 @@ cb_rstto_main_window_clear_private_data (
recent_filter = gtk_recent_filter_new(); recent_filter = gtk_recent_filter_new();
gtk_recent_filter_add_application (recent_filter, "ristretto"); gtk_recent_filter_add_application (recent_filter, "ristretto");
gtk_recent_chooser_add_filter(GTK_RECENT_CHOOSER(dialog), recent_filter); gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (dialog), recent_filter);
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
{ {
uris = gtk_recent_chooser_get_uris (GTK_RECENT_CHOOSER(dialog), &n_uris); uris = gtk_recent_chooser_get_uris (GTK_RECENT_CHOOSER (dialog), &n_uris);
for (i = 0; i < n_uris; ++i) for (i = 0; i < n_uris; ++i)
{ {
gtk_recent_manager_remove_item (window->priv->recent_manager, uris[i], NULL); gtk_recent_manager_remove_item (window->priv->recent_manager, uris[i], NULL);
} }
g_strfreev (uris);
} }
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
......
...@@ -373,7 +373,7 @@ rstto_recent_chooser_get_items ( ...@@ -373,7 +373,7 @@ rstto_recent_chooser_get_items (
GtkRecentFilterInfo filter_info; GtkRecentFilterInfo filter_info;
gsize n_applications; gsize n_applications;
g_list_foreach (items, (GFunc)gtk_recent_info_ref, NULL); g_list_foreach (items, (GFunc) gtk_recent_info_ref, NULL);
while (NULL != all_items_iter) while (NULL != all_items_iter)
{ {
...@@ -381,11 +381,12 @@ rstto_recent_chooser_get_items ( ...@@ -381,11 +381,12 @@ rstto_recent_chooser_get_items (
filter_info.contains = GTK_RECENT_FILTER_URI | GTK_RECENT_FILTER_APPLICATION; filter_info.contains = GTK_RECENT_FILTER_URI | GTK_RECENT_FILTER_APPLICATION;
filter_info.uri = gtk_recent_info_get_uri (info); filter_info.uri = gtk_recent_info_get_uri (info);
filter_info.applications = (const gchar **)gtk_recent_info_get_applications (info, &n_applications); filter_info.applications = (const gchar **) gtk_recent_info_get_applications (info, &n_applications);
if (FALSE == gtk_recent_filter_filter(dialog->priv->timeframe_filter, &filter_info)) if (!gtk_recent_filter_filter (dialog->priv->timeframe_filter, &filter_info))
{ {
items = g_list_remove (items, info); items = g_list_remove (items, info);
gtk_recent_info_unref (info);
} }
else else
{ {
...@@ -393,9 +394,10 @@ rstto_recent_chooser_get_items ( ...@@ -393,9 +394,10 @@ rstto_recent_chooser_get_items (
while (NULL != filters) while (NULL != filters)
{ {
if (FALSE == gtk_recent_filter_filter(filters->data, &filter_info)) if (!gtk_recent_filter_filter (filters->data, &filter_info))
{ {
items = g_list_remove (items, info); items = g_list_remove (items, info);
gtk_recent_info_unref (info);
break; break;
} }
...@@ -403,7 +405,7 @@ rstto_recent_chooser_get_items ( ...@@ -403,7 +405,7 @@ rstto_recent_chooser_get_items (
} }
} }
g_strfreev ((gchar **)filter_info.applications); g_strfreev ((gchar **) filter_info.applications);
all_items_iter = g_list_next (all_items_iter); all_items_iter = g_list_next (all_items_iter);
} }
...@@ -456,12 +458,11 @@ cb_rstto_recent_filter_filter_timeframe( ...@@ -456,12 +458,11 @@ cb_rstto_recent_filter_filter_timeframe(
{ {
RsttoPrivacyDialog *dialog = RSTTO_PRIVACY_DIALOG (user_data); RsttoPrivacyDialog *dialog = RSTTO_PRIVACY_DIALOG (user_data);
GtkRecentInfo *info = gtk_recent_manager_lookup_item (dialog->priv->recent_manager, filter_info->uri, NULL); GtkRecentInfo *info = gtk_recent_manager_lookup_item (dialog->priv->recent_manager, filter_info->uri, NULL);
const time_t visited = gtk_recent_info_get_visited (info);
if ((dialog->priv->time_now - gtk_recent_info_get_visited (info)) < dialog->priv->time_offset) gtk_recent_info_unref (info);
{
return TRUE; return (dialog->priv->time_now - visited) < dialog->priv->time_offset;
}
return FALSE;
} }
/********************/ /********************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment