Unset parent_model when deleting item in model

This commit is contained in:
miruka 2020-03-12 11:27:33 -04:00
parent 8f19adf279
commit e8d4823227

View File

@ -96,9 +96,13 @@ class Model(MutableMapping):
def __delitem__(self, key) -> None: def __delitem__(self, key) -> None:
with self._write_lock: with self._write_lock:
item = self._data.pop(key) item = self._data[key]
item.parent_model = None
del self._data[key]
index = self._sorted_data.index(item) index = self._sorted_data.index(item)
del self._sorted_data[index] del self._sorted_data[index]
ModelItemDeleted(self.sync_id, index) ModelItemDeleted(self.sync_id, index)