From: Mikko Rasa Date: Sun, 30 Jun 2013 20:41:19 +0000 (+0300) Subject: Recreate list items when setting data X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a2dde70bd7a55902d6e7f7634081aa9ff1c1410a;p=libs%2Fgltk.git Recreate list items when setting data --- 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