From 561da5bd7f32e5d09849ac97c69b1acf07cd9a0f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 6 Nov 2020 23:17:30 +0200 Subject: SL-14270 Crash fix --- indra/llui/llfolderviewmodel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index adadf979b7..eae0d2f3e4 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -50,7 +50,14 @@ LLFolderViewModelItemCommon::LLFolderViewModelItemCommon(LLFolderViewModelInterf LLFolderViewModelItemCommon::~LLFolderViewModelItemCommon() { - clearChildren(); + // Children don't belong to model, but to LLFolderViewItem, just mark them as having no parent + std::for_each(mChildren.begin(), mChildren.end(), [](LLFolderViewModelItem* c) {c->setParent(NULL); }); + + // Don't leave dead pointer in parent + if (mParent) + { + mParent->removeChild(this); + } } void LLFolderViewModelItemCommon::dirtyFilter() -- cgit v1.2.3