From a2dde70bd7a55902d6e7f7634081aa9ff1c1410a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 30 Jun 2013 23:41:19 +0300 Subject: [PATCH] Recreate list items when setting data --- source/list.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/list.cpp b/source/list.cpp index 2c13ccc..ec3f994 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -82,6 +82,17 @@ void List::set_data(ListData &d) own_data = false; observer = new DataObserver(*this); + for(vector::iterator i=items.begin(); i!=items.end(); ++i) + delete *i; + items.clear(); + unsigned n_items = data->size(); + for(unsigned i=0; i