From edc46d256194d7078870f0746492d94bd95dd20f Mon Sep 17 00:00:00 2001 From: eidheim Date: Tue, 23 Feb 2016 08:49:05 +0100 Subject: [PATCH] Correctly clears the selectiondialog model after hiding --- src/selectiondialog.cc | 6 ++++++ src/selectiondialog.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/selectiondialog.cc b/src/selectiondialog.cc index 445f4d1..0e9aa21 100644 --- a/src/selectiondialog.cc +++ b/src/selectiondialog.cc @@ -38,6 +38,11 @@ void ListViewText::append(const std::string& value) { new_row->set_value(column_record.text, value); } +void ListViewText::clear() { + unset_model(); + list_store.reset(); +} + SelectionDialogBase::SelectionDialogBase(Gtk::TextView& text_view, Glib::RefPtr start_mark, bool show_search_entry, bool use_markup): text_view(text_view), list_view_text(use_markup), start_mark(start_mark), show_search_entry(show_search_entry) { if(!show_search_entry) @@ -117,6 +122,7 @@ void SelectionDialogBase::hide() { window->hide(); if(on_hide) on_hide(); + list_view_text.clear(); } void SelectionDialogBase::move() { diff --git a/src/selectiondialog.h b/src/selectiondialog.h index 8223918..732652f 100644 --- a/src/selectiondialog.h +++ b/src/selectiondialog.h @@ -17,6 +17,7 @@ public: bool use_markup; ListViewText(bool use_markup); void append(const std::string& value); + void clear(); private: Glib::RefPtr list_store; ColumnRecord column_record;