diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 289ce0bc2cfda4b52a63975e7d1905e47d03210b..8f02391e75a7dcbcf6f2d1b8734aca1550d7969f 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -318,7 +318,12 @@ void llofstream::close() if(is_open()) { if (_Filebuffer->close() == 0) + { _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ + } + delete _Filebuffer; + _Filebuffer = NULL; + _ShouldClose = false; } } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1fd8b0253009bc8c9d8b1a5c41be43aa487898a0..b6f52e3e15c2dc146e5b4fd03cd746840e4f3cd6 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2433,7 +2433,8 @@ void LLAppViewer::initUpdater() mUpdater->setCheckPeriod(check_period); if(gSavedSettings.getBOOL("UpdaterServiceActive")) { - mUpdater->startChecking(); + bool install_if_ready = true; + mUpdater->startChecking(install_if_ready); } LLEventPump & updater_pump = LLEventPumps::instance().obtain(LLUpdaterService::pumpName()); diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 8f385160e9e50c084a03a3f5b62515a4117a468c..885d5535247e86c3de6449e2d06fd110bd85b21e 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -1092,9 +1092,11 @@ LLChicletPanel::LLChicletPanel(const Params&p) LLChicletPanel::~LLChicletPanel() { - LLTransientFloaterMgr::getInstance()->removeControlView(mLeftScrollButton); - LLTransientFloaterMgr::getInstance()->removeControlView(mRightScrollButton); - + if(LLTransientFloaterMgr::instanceExists()) + { + LLTransientFloaterMgr::getInstance()->removeControlView(mLeftScrollButton); + LLTransientFloaterMgr::getInstance()->removeControlView(mRightScrollButton); + } } void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){ diff --git a/indra/newview/lltransientfloatermgr.cpp b/indra/newview/lltransientfloatermgr.cpp index 78dd602f39bbde39b9bdd3f514882fedde3d20fe..6deab96b454602c1a0dccb6431c7c6f91a5f96ad 100644 --- a/indra/newview/lltransientfloatermgr.cpp +++ b/indra/newview/lltransientfloatermgr.cpp @@ -36,8 +36,11 @@ LLTransientFloaterMgr::LLTransientFloaterMgr() { - gViewerWindow->getRootView()->addMouseDownCallback(boost::bind( + if(gViewerWindow) + { + gViewerWindow->getRootView()->addMouseDownCallback(boost::bind( &LLTransientFloaterMgr::leftMouseClickCallback, this, _1, _2, _3)); + } mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(GLOBAL, std::set<LLView*>())); mGroupControls.insert(std::pair<ETransientGroup, std::set<LLView*> >(DOCKED, std::set<LLView*>())); diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index 4820f1f4525d05d48bb64f48f926b972d0e165d7..c17a50e24245aeb3d5846ab5fb569696b744dd7d 100644 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -204,7 +204,11 @@ bool LLUpdateDownloader::Implementation::isDownloading(void) void LLUpdateDownloader::Implementation::resume(void) { - if(isDownloading()) mClient.downloadError("download in progress"); + mCancelled = false; + + if(isDownloading()) { + mClient.downloadError("download in progress"); + } mDownloadRecordPath = downloadMarkerPath(); llifstream dataStream(mDownloadRecordPath); diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index b49f6d04b0daa443d0e43b311d932695a511460e..cc60eaead27a9ba49e5804bce09f4e415c277fb5 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -112,13 +112,13 @@ class LLUpdaterServiceImpl : void setCheckPeriod(unsigned int seconds); - void startChecking(); + void startChecking(bool install_if_ready); void stopChecking(); bool isChecking(); void setAppExitCallback(LLUpdaterService::app_exit_callback_t aecb) { mAppExitCallback = aecb;} - bool checkForInstall(); // Test if a local install is ready. + bool checkForInstall(bool launchInstaller); // Test if a local install is ready. bool checkForResume(); // Test for resumeable d/l. // LLUpdateChecker::Client: @@ -139,6 +139,7 @@ class LLUpdaterServiceImpl : private: void restartTimer(unsigned int seconds); + void stopTimer(); }; const std::string LLUpdaterServiceImpl::sListenerName = "LLUpdaterServiceImpl"; @@ -182,7 +183,7 @@ void LLUpdaterServiceImpl::setCheckPeriod(unsigned int seconds) mCheckPeriod = seconds; } -void LLUpdaterServiceImpl::startChecking() +void LLUpdaterServiceImpl::startChecking(bool install_if_ready) { if(mUrl.empty() || mChannel.empty() || mVersion.empty()) { @@ -193,17 +194,18 @@ void LLUpdaterServiceImpl::startChecking() mIsChecking = true; // Check to see if an install is ready. - if(!checkForInstall()) + bool has_install = checkForInstall(install_if_ready); + if(!has_install) { - checkForResume(); - } + checkForResume(); // will set mIsDownloading to true if resuming - if(!mIsDownloading) - { - // Checking can only occur during the mainloop. - // reset the timer to 0 so that the next mainloop event - // triggers a check; - restartTimer(0); + if(!mIsDownloading) + { + // Checking can only occur during the mainloop. + // reset the timer to 0 so that the next mainloop event + // triggers a check; + restartTimer(0); + } } } @@ -212,12 +214,13 @@ void LLUpdaterServiceImpl::stopChecking() if(mIsChecking) { mIsChecking = false; - mTimer.stop(); + stopTimer(); } if(mIsDownloading) { - this->mUpdateDownloader.cancel(); + mUpdateDownloader.cancel(); + mIsDownloading = false; } } @@ -226,9 +229,9 @@ bool LLUpdaterServiceImpl::isChecking() return mIsChecking; } -bool LLUpdaterServiceImpl::checkForInstall() +bool LLUpdaterServiceImpl::checkForInstall(bool launchInstaller) { - bool result = false; // return true if install is found. + bool foundInstall = false; // return true if install is found. llifstream update_marker(update_marker_path(), std::ios::in | std::ios::binary); @@ -239,7 +242,6 @@ bool LLUpdaterServiceImpl::checkForInstall() LLSD update_info; LLSDSerialize::fromXMLDocument(update_info, update_marker); update_marker.close(); - LLFile::remove(update_marker_path()); // Get the path to the installer file. LLSD path = update_info.get("path"); @@ -251,33 +253,39 @@ bool LLUpdaterServiceImpl::checkForInstall() { llinfos << "ignoring update dowloaded by different client version" << llendl; LLFile::remove(path.asString()); + LLFile::remove(update_marker_path()); } else { ; // Nothing to clean up. } - result = false; + foundInstall = false; } else if(path.isDefined() && !path.asString().empty()) { - int result = ll_install_update(install_script_path(), - update_info["path"].asString(), - install_script_mode()); - - if((result == 0) && mAppExitCallback) + if(launchInstaller) { - mAppExitCallback(); - } else if(result != 0) { - llwarns << "failed to run update install script" << LL_ENDL; - } else { - ; // No op. + LLFile::remove(update_marker_path()); + + int result = ll_install_update(install_script_path(), + update_info["path"].asString(), + install_script_mode()); + + if((result == 0) && mAppExitCallback) + { + mAppExitCallback(); + } else if(result != 0) { + llwarns << "failed to run update install script" << LL_ENDL; + } else { + ; // No op. + } } - result = true; + foundInstall = true; } } - return result; + return foundInstall; } bool LLUpdaterServiceImpl::checkForResume() @@ -324,7 +332,7 @@ void LLUpdaterServiceImpl::optionalUpdate(std::string const & newVersion, LLURI const & uri, std::string const & hash) { - mTimer.stop(); + stopTimer(); mIsDownloading = true; mUpdateDownloader.download(uri, hash); } @@ -333,7 +341,7 @@ void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion, LLURI const & uri, std::string const & hash) { - mTimer.stop(); + stopTimer(); mIsDownloading = true; mUpdateDownloader.download(uri, hash); } @@ -394,12 +402,17 @@ void LLUpdaterServiceImpl::restartTimer(unsigned int seconds) sListenerName, boost::bind(&LLUpdaterServiceImpl::onMainLoop, this, _1)); } +void LLUpdaterServiceImpl::stopTimer() +{ + mTimer.stop(); + LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); +} + bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) { if(mTimer.getStarted() && mTimer.hasExpired()) { - mTimer.stop(); - LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); + stopTimer(); // Check for failed install. if(LLFile::isfile(ll_install_failed_marker_path())) @@ -468,9 +481,9 @@ void LLUpdaterService::setCheckPeriod(unsigned int seconds) mImpl->setCheckPeriod(seconds); } -void LLUpdaterService::startChecking() +void LLUpdaterService::startChecking(bool install_if_ready) { - mImpl->startChecking(); + mImpl->startChecking(install_if_ready); } void LLUpdaterService::stopChecking() diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 55824af1881d0214243d6fcc630d30e5b2fa6509..752a6f834b4f93a7204a9e8573d30812f9d7de90 100644 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -62,7 +62,7 @@ class LLUpdaterService void setCheckPeriod(unsigned int seconds); - void startChecking(); + void startChecking(bool install_if_ready = false); void stopChecking(); bool isChecking();