diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-03-30 21:39:26 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-30 23:05:14 +0200 |
commit | 7bd077a3ae0e3b69cfb0e36455610e7f3429977b (patch) | |
tree | 337bf87479118b5427b93001635667f046ff3342 /Libraries/LibGUI/AbstractView.cpp | |
parent | 3fcea715381c755da2ad4d6a18a0d66dbe1a50e1 (diff) | |
download | serenity-7bd077a3ae0e3b69cfb0e36455610e7f3429977b.zip |
LibGUI: Fix index invalidation
When the model gets updated, we have to let go of the old indexes,
because they're invalid from that moment on.
Fixes https://github.com/SerenityOS/serenity/issues/1541
Diffstat (limited to 'Libraries/LibGUI/AbstractView.cpp')
-rw-r--r-- | Libraries/LibGUI/AbstractView.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Libraries/LibGUI/AbstractView.cpp b/Libraries/LibGUI/AbstractView.cpp index bc06ba4b2c..952064f467 100644 --- a/Libraries/LibGUI/AbstractView.cpp +++ b/Libraries/LibGUI/AbstractView.cpp @@ -60,8 +60,10 @@ void AbstractView::set_model(RefPtr<Model> model) void AbstractView::did_update_model() { - if (!model() || selection().first() != m_edit_index) - stop_editing(); + stop_editing(); + m_edit_index = {}; + m_hovered_index = {}; + selection().clear(); } void AbstractView::did_update_selection() |