Skip to content
  • Olivier Goffart's avatar
    Models: fix writing data doesn't update ListView model data property · d55803d2
    Olivier Goffart 创作于
    This fixes a couple of bug:
     - Bug #3740 happens because `Repeater::model_set_row_data` did not use
       the inner.offset to get the instance (So that's the `val == 106` part
       of the test)
     - But I went ahead and also tested what happenned if you changed the
       model from the "outside" using the `model[i] = `, and that was not
       implemented, hence the move of the code from
       `Repeater::model_set_row_data` to `RepeaterTracker::row_changed`,
       That does need Pin though, so Pin was added everywhere
     - C++ is not affected by bug #3740, because because the C++ listview
       don't do the "allocate only visible" optimization. But the
       "val == 1106" part of the test would fail so this patch also moces
       the update from  `model_set_row_data` to `row_changed`.
       But following that we don't set the state as Dirty in `row_changed`,
       the write_to_model test started filling  because the `row_added`
       function was missing an update of the index on every further items
    
    The change in the interpreter prevent a borrow_mut from causing trouble.
    The Value really don't need to be in a RefCell anyway
    
    Fix #3740
    d55803d2