summaryrefslogtreecommitdiff
path: root/indra/newview/llconversationlog.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-08-03 13:54:35 -0700
committerMerov Linden <merov@lindenlab.com>2012-08-03 13:54:35 -0700
commitd6d35d970f3a7b4db7e29f7d2eddb0c078cba4a5 (patch)
tree18b02f063987e9a6b80036307990802ce0c84d0e /indra/newview/llconversationlog.cpp
parent0fa1e2b9ae41bb06e5c7db90900d4f469f44b8d3 (diff)
CHUI-263 : Fix crash on exit. LLSingleton like LLConversationLog cannot be an LLFriendObserver at the same time.
Diffstat (limited to 'indra/newview/llconversationlog.cpp')
-rw-r--r--indra/newview/llconversationlog.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index df9350407d..137b97326c 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -140,6 +140,31 @@ void LLConversation::setListenIMFloaterOpened()
}
}
/************************************************************************/
+/* LLConversationLogFriendObserver implementation */
+/************************************************************************/
+
+// Note : An LLSingleton like LLConversationLog cannot be an LLFriendObserver
+// at the same time.
+// This is because avatar observers are deleted by the observed object which
+// conflicts with the way LLSingleton are deleted.
+
+class LLConversationLogFriendObserver : public LLFriendObserver
+{
+public:
+ LLConversationLogFriendObserver() {}
+ virtual ~LLConversationLogFriendObserver() {}
+ virtual void changed(U32 mask);
+};
+
+void LLConversationLogFriendObserver::changed(U32 mask)
+{
+ if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
+ {
+ LLConversationLog::instance().notifyObservers();
+ }
+}
+
+/************************************************************************/
/* LLConversationLog implementation */
/************************************************************************/
@@ -148,7 +173,9 @@ LLConversationLog::LLConversationLog()
loadFromFile(getFileName());
LLIMMgr::instance().addSessionObserver(this);
- LLAvatarTracker::instance().addObserver(this);
+
+ mFriendObserver = new LLConversationLogFriendObserver;
+ LLAvatarTracker::instance().addObserver(mFriendObserver);
}
void LLConversationLog::logConversation(const LLConversation& conversation)
{
@@ -204,15 +231,6 @@ void LLConversationLog::sessionAdded(const LLUUID& session_id, const std::string
}
}
-// LLFriendObserver
-void LLConversationLog::changed(U32 mask)
-{
- if (mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE))
- {
- notifyObservers();
- }
-}
-
void LLConversationLog::cache()
{
saveToFile(getFileName());