FileManager: Ignore model updates during widget construction

We can't use current_view() before we've actually constructed the
subviews, so just ignore statusbar update requests before they get
a chance to call current_view().

This is not the most beautiful thing, and maybe we can think of a
nicer approach.
This commit is contained in:
Andreas Kling 2020-10-22 18:52:54 +02:00
parent 5fdc8c14a6
commit c31cc8c060
Notes: sideshowbarker 2024-07-19 01:48:14 +09:00

View File

@ -388,6 +388,10 @@ void DirectoryView::open_next_directory()
void DirectoryView::update_statusbar()
{
// If we're triggered during widget construction, just ignore it.
if (m_view_mode == ViewMode::Invalid)
return;
size_t total_size = model().node({}).total_size;
if (current_view().selection().is_empty()) {
set_status_message(String::formatted("{} item(s) ({})",