summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-03-28 00:45:38 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-03-28 20:38:15 +0200
commit50a70fe2f831c6d34a6f518ae040e52ac2f9f924 (patch)
tree87fc571c38587336fd467a7161356d69701039d0
parentf382180eb584d8e8690935a63bda3039fe8bccc9 (diff)
viewer#1073 crash at loadSkeleton
looks like file that was being parced got corrupted 'in progress'
-rw-r--r--indra/llcommon/llsys.cpp4
-rw-r--r--indra/newview/llinventorymodel.cpp13
-rw-r--r--indra/newview/llstartup.cpp4
3 files changed, 19 insertions, 2 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 938685bae6..352628f129 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -1352,6 +1352,10 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
} while(gzeof(src) == 0);
fclose(dst);
dst = NULL;
+#if LL_WINDOWS
+ // Rename in windows needs the dstfile to not exist.
+ LLFile::remove(dstfile, ENOENT);
+#endif
if (LLFile::rename(tmpfile, dstfile) == -1) goto err; /* Flawfinder: ignore */
retval = TRUE;
err:
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index eebc79c1c6..10feb16346 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2705,6 +2705,17 @@ bool LLInventoryModel::loadSkeleton(
gzip_filename.append(".gz");
LLFILE* fp = LLFile::fopen(gzip_filename, "rb");
bool remove_inventory_file = false;
+ if (LLAppViewer::instance()->isSecondInstance())
+ {
+ // Safeguard viewer against trying to unpack file twice
+ // ex: user logs into two accounts simultaneously, so two
+ // viewers are trying to unpack library into same file
+ //
+ // Would be better to do it in gunzip_file, but it doesn't
+ // have access to llfilesystem
+ inventory_filename = gDirUtilp->getTempFilename();
+ remove_inventory_file = true;
+ }
if(fp)
{
fclose(fp);
@@ -2913,7 +2924,7 @@ bool LLInventoryModel::loadSkeleton(
// clean up the gunzipped file.
LLFile::remove(inventory_filename);
}
- if(is_cache_obsolete)
+ if(is_cache_obsolete && !LLAppViewer::instance()->isSecondInstance())
{
// If out of date, remove the gzipped file too.
LL_WARNS(LOG_INV) << "Inv cache out of date, removing" << LL_ENDL;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index f30810fb81..6799f8cfdd 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2951,7 +2951,9 @@ std::string LLStartUp::startupStateToString(EStartupState state)
RTNENUM( STATE_AGENT_SEND );
RTNENUM( STATE_AGENT_WAIT );
RTNENUM( STATE_INVENTORY_SEND );
- RTNENUM(STATE_INVENTORY_CALLBACKS );
+ RTNENUM( STATE_INVENTORY_CALLBACKS );
+ RTNENUM( STATE_INVENTORY_SKEL );
+ RTNENUM( STATE_INVENTORY_SEND2 );
RTNENUM( STATE_MISC );
RTNENUM( STATE_PRECACHE );
RTNENUM( STATE_WEARABLES_WAIT );