summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Palange (Mani) <palange@lindenlab.com>2010-11-18 21:57:27 -0800
committerMark Palange (Mani) <palange@lindenlab.com>2010-11-18 21:57:27 -0800
commit8c2026d6b71f133deafa6b0e19baf69632a2510a (patch)
tree580083310e6298a8b68aba59a566d18a970d6fbb
parente19ee531aedcbbe0f77a8ac11cdcda43c9c4ed84 (diff)
CHOP-135 Bug fixes.
-rw-r--r--indra/llcommon/llfile.cpp5
-rw-r--r--indra/newview/llappviewer.cpp3
-rw-r--r--indra/newview/llchiclet.cpp8
-rw-r--r--indra/newview/lltransientfloatermgr.cpp5
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.cpp6
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp85
-rw-r--r--indra/viewer_components/updater/llupdaterservice.h2
7 files changed, 71 insertions, 43 deletions
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index 289ce0bc2c..8f02391e75 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 1fd8b02530..b6f52e3e15 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 8f385160e9..885d553524 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 78dd602f39..6deab96b45 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 4820f1f452..c17a50e242 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 b49f6d04b0..cc60eaead2 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -112,13 +112,13 @@ public:
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 @@ public:
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 55824af188..752a6f834b 100644
--- a/indra/viewer_components/updater/llupdaterservice.h
+++ b/indra/viewer_components/updater/llupdaterservice.h
@@ -62,7 +62,7 @@ public:
void setCheckPeriod(unsigned int seconds);
- void startChecking();
+ void startChecking(bool install_if_ready = false);
void stopChecking();
bool isChecking();