Rewrite the inventory corruption fix to reduce possible side-effects

master
Beq 2022-12-17 16:31:16 +00:00
parent d486550651
commit 5ddbef4a25
2 changed files with 68 additions and 32 deletions

View File

@ -1773,7 +1773,9 @@ bool LLAppViewer::doFrame()
{
LLVoiceClient::getInstance()->terminate();
}
// <FS:Beq> [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write.
persistCachesAndSettings();
// </FS:Beq>
disconnectViewer();
resumeMainloopTimeout();
}
@ -2056,13 +2058,11 @@ bool LLAppViewer::cleanup()
// Give any remaining SLPlugin instances a chance to exit cleanly.
LLPluginProcessParent::shutdown();
// <FS:Beq> [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write.
// disconnectViewer();
// LLViewerCamera::deleteSingleton();
// LL_INFOS() << "Viewer disconnected" << LL_ENDL;
disconnectViewer();
LLViewerCamera::deleteSingleton();
// </FS:Beq>
LL_INFOS() << "Viewer disconnected" << LL_ENDL;
if (gKeyboard)
{
gKeyboard->resetKeys();
@ -4865,8 +4865,7 @@ void LLAppViewer::removeDumpDir()
void LLAppViewer::forceQuit()
{
// <FS:Beq> [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write.
disconnectViewer();
LL_INFOS() << "Viewer disconnected" << LL_ENDL;
persistCachesAndSettings();
// </FS:Beq>
LLApp::setQuitting();
}
@ -6365,14 +6364,48 @@ void LLAppViewer::idleNetwork()
mAgentRegionLastAlive = this_region_alive;
}
}
void LLAppViewer::persistCachesAndSettings()
{
// Save inventory to disk if appropriate
if (gInventory.isInventoryUsable()
&& gAgent.getID().notNull()) // Shouldn't be null at this stage
{
LL_INFOS() << "Saving Inventory Cache" << LL_ENDL;
gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
if (gInventory.getLibraryRootFolderID().notNull()
&& gInventory.getLibraryOwnerID().notNull())
{
gInventory.cache(
gInventory.getLibraryRootFolderID(),
gInventory.getLibraryOwnerID());
}
LL_INFOS() << "Saving Inventory Cache : COMPLETED" << LL_ENDL;
}
else
{
LL_INFOS() << "Not Saving Inventory Cache : Inventory is currently unusable" << LL_ENDL;
}
// Persist name cache
LLAvatarNameCache::instance().setCustomNameCheckCallback(LLAvatarNameCache::custom_name_check_callback_t()); // <FS:Ansariel> Contact sets
LL_INFOS() << "Saving Name Cache" << LL_ENDL;
saveNameCache();
LL_INFOS() << "Saving Name Cache : COMPLETED" << LL_ENDL;
// Save experience cache if appropriate
if (LLExperienceCache::instanceExists())
{
LL_INFOS() << "Saving Experience Cache" << LL_ENDL;
LLExperienceCache::instance().cleanup();
LL_INFOS() << "Saving Experience Cache : COMPLETED" << LL_ENDL;
}
}
void LLAppViewer::disconnectViewer()
{
if (gDisconnected)
{
return;
}
gDisconnected = TRUE;// <FS:Beq> [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write.
//
// Cleanup after quitting.
//
@ -6402,30 +6435,32 @@ void LLAppViewer::disconnectViewer()
{
LLSelectMgr::getInstance()->deselectAll();
}
// <FS:Beq> [FIRE-32453] [BUG-232971] Persist before disconnect
// Moved to separate function
// // save inventory if appropriate
// if (gInventory.isInventoryUsable()
// && gAgent.getID().notNull()) // Shouldn't be null at this stage
// {
// gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
// if (gInventory.getLibraryRootFolderID().notNull()
// && gInventory.getLibraryOwnerID().notNull())
// {
// gInventory.cache(
// gInventory.getLibraryRootFolderID(),
// gInventory.getLibraryOwnerID());
// }
// }
// save inventory if appropriate
if (gInventory.isInventoryUsable()
&& gAgent.getID().notNull()) // Shouldn't be null at this stage
{
gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
if (gInventory.getLibraryRootFolderID().notNull()
&& gInventory.getLibraryOwnerID().notNull())
{
gInventory.cache(
gInventory.getLibraryRootFolderID(),
gInventory.getLibraryOwnerID());
}
}
LLAvatarNameCache::instance().setCustomNameCheckCallback(LLAvatarNameCache::custom_name_check_callback_t()); // <FS:Ansariel> Contact sets
saveNameCache();
if (LLExperienceCache::instanceExists())
{
// TODO: LLExperienceCache::cleanup() logic should be moved to
// cleanupSingleton().
LLExperienceCache::instance().cleanup();
}
// LLAvatarNameCache::instance().setCustomNameCheckCallback(LLAvatarNameCache::custom_name_check_callback_t()); // <FS:Ansariel> Contact sets
// saveNameCache();
// if (LLExperienceCache::instanceExists())
// {
// // TODO: LLExperienceCache::cleanup() logic should be moved to
// // cleanupSingleton().
// LLExperienceCache::instance().cleanup();
// }
// </FS:Beq>
// close inventory interface, close all windows
LLSidepanelInventory::cleanup();
@ -6455,7 +6490,7 @@ void LLAppViewer::disconnectViewer()
LLDestroyClassList::instance().fireCallbacks();
cleanup_xfer_manager();
// gDisconnected = TRUE; // <FS:Beq/> [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write.
gDisconnected = TRUE;
// Pass the connection state to LLUrlEntryParcel not to attempt
// parcel info requests while disconnected.

View File

@ -287,6 +287,7 @@ private:
void idleNetwork();
void sendLogoutRequest();
void persistCachesAndSettings();
void disconnectViewer();
// *FIX: the app viewer class should be some sort of singleton, no?