summaryrefslogtreecommitdiff
path: root/indra/llui/llnotifications.h
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-24 02:23:20 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-11-24 15:15:10 +0200
commit6b3dd7929b4038a2c4c6d1b563a3b0735b3a020d (patch)
treebcbdcf7f8e74bc872945b579a1aa99d84e9341d3 /indra/llui/llnotifications.h
parentdce1fae986f4f61f51e7825de903aa58239c28c8 (diff)
SL-17076 Thread safety of LLNotificationChannelBase's items
Due to odd crashes when cleaning mItems adding thread safety Viewer runs window in a separate thread, it is possible notification was added in a way that corrupted the list.
Diffstat (limited to 'indra/llui/llnotifications.h')
-rw-r--r--indra/llui/llnotifications.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 1577038c36..4d71d189f2 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -738,16 +738,19 @@ class LLNotificationChannelBase :
{
LOG_CLASS(LLNotificationChannelBase);
public:
- LLNotificationChannelBase(LLNotificationFilter filter)
- : mFilter(filter),
- mItems()
- {}
+ LLNotificationChannelBase(LLNotificationFilter filter)
+ : mFilter(filter)
+ , mItems()
+ , mItemsMutex()
+ {}
+
virtual ~LLNotificationChannelBase()
{
// explicit cleanup for easier issue detection
mChanged.disconnect_all_slots();
mPassedFilter.disconnect_all_slots();
mFailedFilter.disconnect_all_slots();
+ LLMutexLock lock(&mItemsMutex);
mItems.clear();
}
// you can also connect to a Channel, so you can be notified of
@@ -786,6 +789,7 @@ protected:
LLStandardSignal mChanged;
LLStandardSignal mPassedFilter;
LLStandardSignal mFailedFilter;
+ LLMutex mItemsMutex;
// these are action methods that subclasses can override to take action
// on specific types of changes; the management of the mItems list is
@@ -844,14 +848,14 @@ public:
{
return boost::iterator_range<parents_iter>(mParents);
}
-
+
bool isEmpty() const;
S32 size() const;
-
- Iterator begin();
- Iterator end();
- size_t size();
-
+ size_t size();
+
+ typedef boost::function<void(LLNotificationPtr)> NotificationProcess;
+ void forEachNotification(NotificationProcess process);
+
std::string summarize();
protected:
@@ -926,10 +930,6 @@ public:
void update(const LLNotificationPtr pNotif);
LLNotificationPtr find(LLUUID uuid);
-
- typedef boost::function<void (LLNotificationPtr)> NotificationProcess;
-
- void forEachNotification(NotificationProcess process);
// This is all stuff for managing the templates
// take your template out