Fix some crashiness on removing things from EditableList.
authorCarl Hetherington <cth@carlh.net>
Sat, 17 Aug 2013 22:15:00 +0000 (23:15 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 17 Aug 2013 22:15:00 +0000 (23:15 +0100)
src/wx/editable_list.h

index 5eb46e80d11caabe372df5b399d776f8d1d1fdf8..98e7d0bfd64509ba503db48cba2a8db9113bb6bf 100644 (file)
@@ -143,13 +143,16 @@ private:
        void remove_clicked ()
        {
                int i = _list->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
-               if (i >= 0) {
-                       _list->DeleteItem (i);
+               if (i == -1) {
+                       return;
                }
                
+               _list->DeleteItem (i);
                std::vector<T> all = _get ();
                all.erase (all.begin() + i);
                _set (all);
+
+               selection_changed ();
        }
 
        void resized (wxSizeEvent& ev)