diff options
Diffstat (limited to 'indra/newview/llchannelmanager.cpp')
-rw-r--r-- | indra/newview/llchannelmanager.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index d6240838b6..9e7a8ba95c 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -48,25 +48,39 @@ LLChannelManager::LLChannelManager() LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLChannelManager::onLoginCompleted, this)); mChannelList.clear(); mStartUpChannel = NULL; - + if(!gViewerWindow) { LL_ERRS() << "LLChannelManager::LLChannelManager() - viwer window is not initialized yet" << LL_ENDL; } + + // We don't actually need this instance right now, but our + // cleanupSingleton() method deletes LLScreenChannels, which need to + // unregister from LLUI. Calling LLUI::instance() here establishes the + // dependency so LLSingletonBase::deleteAll() calls our deleteSingleton() + // before LLUI::deleteSingleton(). + LLUI::instance(); } //-------------------------------------------------------------------------- LLChannelManager::~LLChannelManager() { - for(std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it) - { - LLScreenChannelBase* channel = it->channel.get(); - if (!channel) continue; +} - delete channel; - } +//-------------------------------------------------------------------------- +void LLChannelManager::cleanupSingleton() +{ + // Note: LLScreenChannelBase is a LLUICtrl and depends onto other singletions + // not captured by singleton-dependency, so cleanup it here instead of destructor + for (std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it) + { + LLScreenChannelBase* channel = it->channel.get(); + if (!channel) continue; - mChannelList.clear(); + delete channel; + } + + mChannelList.clear(); } //-------------------------------------------------------------------------- |