Skip to content

Commit

Permalink
fix message window leaks
Browse files Browse the repository at this point in the history
Stop leaking my new message windows and their data.
  • Loading branch information
flatcap committed Jun 4, 2022
1 parent c4efb73 commit d5b865c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
20 changes: 6 additions & 14 deletions enter/window.c
Expand Up @@ -232,20 +232,11 @@ int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags
// clang-format on
win->wdata = &wdata;

if (wdata.state->wbuf)
{
/* Coming back after return 1 */
wdata.redraw = ENTER_REDRAW_LINE;
wdata.first = false;
}
else
{
/* Initialise wbuf from buf */
wdata.state->wbuflen = 0;
wdata.state->lastchar = mutt_mb_mbstowcs(&wdata.state->wbuf,
&wdata.state->wbuflen, 0, wdata.buf);
wdata.redraw = ENTER_REDRAW_INIT;
}
/* Initialise wbuf from buf */
wdata.state->wbuflen = 0;
wdata.state->lastchar = mutt_mb_mbstowcs(&wdata.state->wbuf,
&wdata.state->wbuflen, 0, wdata.buf);
wdata.redraw = ENTER_REDRAW_INIT;

if (wdata.flags & MUTT_COMP_FILE)
wdata.hclass = HC_FILE;
Expand Down Expand Up @@ -366,6 +357,7 @@ int mutt_buffer_get_field(const char *field, struct Buffer *buf, CompletionFlags
mutt_window_move(win, 0, 0);
mutt_window_clearline(win, 0);
window_set_focus(old_focus);
mutt_window_free(&win);

if (rc == 0)
mutt_buffer_fix_dptr(buf);
Expand Down
1 change: 1 addition & 0 deletions progress/window.c
Expand Up @@ -293,6 +293,7 @@ struct MuttWindow *progress_window_new(const char *msg, size_t size, size_t size
mutt_str_pretty_size(wdata->pretty_size, sizeof(wdata->pretty_size), size);

win->wdata = wdata;
win->wdata_free = progress_wdata_free;

return win;
}

0 comments on commit d5b865c

Please sign in to comment.