Merge pull request #2005 from SijmenSchoon/fix-assertions

Fix tree-related assertions on startup on Linux
This commit is contained in:
Vojtech Kral 2019-03-27 11:29:32 +01:00 committed by GitHub
commit 8dbbfc140b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -542,7 +542,10 @@ void Tab::update_changed_tree_ui()
auto cur_item = m_treectrl->GetFirstVisibleItem();
if (!cur_item || !m_treectrl->IsVisible(cur_item))
return;
auto selection = m_treectrl->GetItemText(m_treectrl->GetSelection());
auto selected_item = m_treectrl->GetSelection();
auto selection = selected_item ? m_treectrl->GetItemText(selected_item) : "";
while (cur_item) {
auto title = m_treectrl->GetItemText(cur_item);
for (auto page : m_pages)
@ -2497,7 +2500,10 @@ void Tab::rebuild_page_tree()
if (!have_selection) {
// this is triggered on first load, so we don't disable the sel change event
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
auto item = m_treectrl->GetFirstVisibleItem();
if (item) {
m_treectrl->SelectItem(item);
}
}
// Thaw();
}
@ -2524,7 +2530,10 @@ void Tab::update_page_tree_visibility()
if (!have_selection) {
// this is triggered on first load, so we don't disable the sel change event
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
auto item = m_treectrl->GetFirstVisibleItem();
if (item) {
m_treectrl->SelectItem(item);
}
}
}