summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-10-16 17:14:06 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-10-16 20:14:47 +0300
commitb011263b60d95048f89947717f6cb915f3628aae (patch)
treecc84d26e271285b8a83c8e36d94d7bbf44c84d6e
parent03fa846ac7f103c72d300ad000efff1fdfa3e6af (diff)
#3379 Fix callback cleanup
Instead of marking as 0, mark for cleanup
-rw-r--r--indra/llui/llfolderviewitem.cpp18
-rw-r--r--indra/llui/llfolderviewitem.h1
2 files changed, 14 insertions, 5 deletions
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 0f9fd35868..878f1cb856 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -1884,10 +1884,18 @@ void LLFolderViewFolder::updateHasFavorites(bool new_childs_value)
void LLFolderViewFolder::onIdleUpdateFavorites(void* data)
{
LLFolderViewFolder* self = reinterpret_cast<LLFolderViewFolder*>(data);
+ if (self->mFavoritesDirtyFlags == FAVORITE_CLEANUP)
+ {
+ // parent or child already processed the update, clean the callback
+ self->mFavoritesDirtyFlags = 0;
+ gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, data);
+ return;
+ }
+
if (self->mFavoritesDirtyFlags == 0)
{
- // already processed either on previous run or by a different callback
- gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, self);
+ llassert(false); // should not happen, everything that sets to 0 should clean callback
+ gIdleCallbacks.deleteFunction(&LLFolderViewFolder::onIdleUpdateFavorites, data);
return;
}
@@ -1915,7 +1923,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data)
// Parent will remove onIdleUpdateFavorites later, don't remove now,
// We are inside gIdleCallbacks. Removing 'self' callback is safe,
// but removing 'parent' can invalidate following iterator
- parent->mFavoritesDirtyFlags = 0;
+ parent->mFavoritesDirtyFlags = FAVORITE_CLEANUP;
}
parent = parent->getParentFolder();
}
@@ -1981,7 +1989,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data)
// Parent will remove onIdleUpdateFavorites later, don't remove now,
// We are inside gIdleCallbacks. Removing 'self' callback is safe,
// but removing 'parent' can invalidate following iterator
- parent->mFavoritesDirtyFlags = 0;
+ parent->mFavoritesDirtyFlags = FAVORITE_CLEANUP;
}
parent = parent->getParentFolder();
}
@@ -1992,7 +2000,7 @@ void LLFolderViewFolder::onIdleUpdateFavorites(void* data)
// Parent will remove onIdleUpdateFavorites later, don't remove now.
// We are inside gIdleCallbacks. Removing 'self' callback is safe,
// but removing 'parent' can invalidate following iterator
- parent->mFavoritesDirtyFlags = 0;
+ parent->mFavoritesDirtyFlags = FAVORITE_CLEANUP;
}
parent = parent->getParentFolder();
}
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index c9b003b892..23d794bf26 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -421,6 +421,7 @@ private:
constexpr static S32 FAVORITE_ADDED = 1;
constexpr static S32 FAVORITE_REMOVED = 2;
+ constexpr static S32 FAVORITE_CLEANUP = 4;
S32 mFavoritesDirtyFlags { 0 };
public: