mirror of https://github.com/MidnightCommander/mc
Merge branch '2545_save_history_fix'
* 2545_save_history_fix: (push_history): fixed memory leak. (input_destroy): optimization: don't do useless actions. Ticket #2545: fixup of saving WInput history.
This commit is contained in:
commit
7963f44daa
|
@ -251,6 +251,8 @@ push_history (WInput * in, const char *text)
|
||||||
in->history_changed = TRUE;
|
in->history_changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (t);
|
||||||
|
|
||||||
in->need_push = FALSE;
|
in->need_push = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,13 +844,13 @@ input_save_history (const gchar * event_group_name, const gchar * event_name,
|
||||||
(void) event_group_name;
|
(void) event_group_name;
|
||||||
(void) event_name;
|
(void) event_name;
|
||||||
|
|
||||||
if (in->history != NULL && in->history_changed && !in->is_password &&
|
if (!in->is_password && (((Widget *) in)->owner->ret_value != B_CANCEL))
|
||||||
(((Widget *) in)->owner->ret_value != B_CANCEL))
|
|
||||||
{
|
{
|
||||||
ev_history_load_save_t *ev = (ev_history_load_save_t *) data;
|
ev_history_load_save_t *ev = (ev_history_load_save_t *) data;
|
||||||
|
|
||||||
push_history (in, in->buffer);
|
push_history (in, in->buffer);
|
||||||
history_save (ev->cfg, in->history_name, in->history);
|
if (in->history_changed)
|
||||||
|
history_save (ev->cfg, in->history_name, in->history);
|
||||||
in->history_changed = FALSE;
|
in->history_changed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +868,7 @@ input_destroy (WInput * in)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_clean (in);
|
input_free_completions (in);
|
||||||
|
|
||||||
/* clean history */
|
/* clean history */
|
||||||
if (in->history != NULL)
|
if (in->history != NULL)
|
||||||
|
|
Loading…
Reference in New Issue