Commit c9237b5d authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

do not leak the list of selected documents. Noticed by Vincent Geddes (bug

2006-03-14  Paolo Borelli  <pborelli@katamail.com>

	* gedit/dialogs/gedit-close-confirmation-dialog.[ch]:
	* gedit/gedit-commands-file.c:
	* gedit/gedit-session.c:

	do not leak the list of selected documents.
	Noticed by Vincent Geddes (bug 333882).
parent d5350829
2006-03-14 Paolo Borelli <pborelli@katamail.com>
* gedit/dialogs/gedit-close-confirmation-dialog.[ch]:
* gedit/gedit-commands-file.c:
* gedit/gedit-session.c:
do not leak the list of selected documents.
Noticed by Vincent Geddes (bug 333882).
2006-03-13 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-commands-search.c: fix sanity check, typo spotted
......
......@@ -315,7 +315,7 @@ get_selected_docs (GtkTreeModel *store)
return list;
}
const GList *
GList *
gedit_close_confirmation_dialog_get_selected_documents (GeditCloseConfirmationDialog *dlg)
{
GeditCloseConfirmationDialogPrivate *priv;
......
......@@ -66,7 +66,7 @@ GtkWidget *gedit_close_confirmation_dialog_new_single (GtkWindow *parent,
const GList *gedit_close_confirmation_dialog_get_unsaved_documents (GeditCloseConfirmationDialog *dlg);
const GList *gedit_close_confirmation_dialog_get_selected_documents (GeditCloseConfirmationDialog *dlg);
GList *gedit_close_confirmation_dialog_get_selected_documents (GeditCloseConfirmationDialog *dlg);
#endif /* __GEDIT_CLOSE_CONFIRMATION_DIALOG_H__ */
......@@ -617,6 +617,8 @@ save_dialog_response_cb (GeditFileChooserDialog *dialog,
_("Saving file '%s'\342\200\246"),
uri_for_display);
g_free (uri_for_display);
_gedit_tab_save_as (tab, uri, encoding);
}
......@@ -669,12 +671,17 @@ confirm_overwrite_callback (GtkFileChooser *dialog,
gpointer data)
{
gchar *uri;
gboolean ro;
gedit_debug (DEBUG_COMMANDS);
uri = gtk_file_chooser_get_uri (dialog);
if (is_read_only (uri))
ro = is_read_only (uri);
g_free (uri);
if (ro)
{
if (replace_read_only_file (GTK_WINDOW (dialog), uri))
return GTK_FILE_CHOOSER_CONFIRMATION_ACCEPT_FILENAME;
......@@ -1463,8 +1470,7 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
gint response_id,
GeditWindow *window)
{
const GList *unsaved_documents;
const GList *selected_documents;
GList *selected_documents;
gboolean is_closing_all;
gedit_debug (DEBUG_COMMANDS);
......@@ -1474,8 +1480,6 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
gtk_widget_hide (GTK_WIDGET (dlg));
unsaved_documents = gedit_close_confirmation_dialog_get_unsaved_documents (dlg);
switch (response_id)
{
case GTK_RESPONSE_YES: /* Save and Close */
......@@ -1509,6 +1513,9 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
window);
}
}
g_list_free (selected_documents);
break;
case GTK_RESPONSE_NO: /* Close without Saving */
......@@ -1524,6 +1531,9 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
}
else
{
const GList *unsaved_documents;
unsaved_documents = gedit_close_confirmation_dialog_get_unsaved_documents (dlg);
g_return_if_fail (unsaved_documents->next == NULL);
close_document (window,
......
......@@ -369,7 +369,7 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
gint response_id,
GeditWindow *window)
{
const GList *selected_documents;
GList *selected_documents;
GSList *l;
gedit_debug (DEBUG_COMMANDS);
......@@ -391,11 +391,11 @@ close_confirmation_dialog_response_handler (GeditCloseConfirmationDialog *dlg,
g_object_set_data (G_OBJECT (window),
GEDIT_SESSION_LIST_OF_DOCS_TO_SAVE,
g_list_copy (selected_documents));
selected_documents);
_gedit_cmd_file_save_documents_list (window, selected_documents);
// FIXME: also need to lock the window to prevent further changes..
/* FIXME: also need to lock the window to prevent further changes... */
break;
......
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