From 36a14ebf0ad1fa00b7e8b8d841d7a8147dce3810 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 23 Sep 2024 21:37:16 +0200 Subject: [PATCH] dialogs/TextInputDialog: call CommitHistory() only when dialog is confirmed Fixes crash bug when CommitHistory() is called after Cancel() has already called history->pop_back(). --- NEWS | 1 + src/dialogs/TextInputDialog.cxx | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index bd287316..76821ddd 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ncmpc 0.51 - not yet released * repaint main area after terminal was resized * pressing Enter while in "jump mode" activates selected item +* fix crash in new text input dialog ncmpc 0.50 - (2024-09-12) * build: require Meson 0.60 diff --git a/src/dialogs/TextInputDialog.cxx b/src/dialogs/TextInputDialog.cxx index 5c9f6fa8..9a5dce03 100644 --- a/src/dialogs/TextInputDialog.cxx +++ b/src/dialogs/TextInputDialog.cxx @@ -50,8 +50,6 @@ TextInputDialog::SetReady() noexcept assert(!ready); ready = true; - CommitHistory(); - if (continuation) continuation.resume(); } @@ -237,6 +235,7 @@ TextInputDialog::OnKey(const Window window, int key) return false; } + CommitHistory(); SetReady(); return true; }