From d668b30002a571a9beea5b5949fb072270279d72 Mon Sep 17 00:00:00 2001 From: Beq Date: Sat, 17 Dec 2022 16:31:16 +0000 Subject: [PATCH] Revert "Rewrite the inventory corruption fix to reduce possible side-effects" This reverts commit 5ddbef4a2588e504ab71a468b006b129cb7bd0df. --- indra/newview/llappviewer.cpp | 99 +++++++++++------------------------ indra/newview/llappviewer.h | 1 - 2 files changed, 32 insertions(+), 68 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 7e4d01b2e8..5b10a43a0a 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1773,9 +1773,7 @@ bool LLAppViewer::doFrame() { LLVoiceClient::getInstance()->terminate(); } - // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. - persistCachesAndSettings(); - // + disconnectViewer(); resumeMainloopTimeout(); } @@ -2058,11 +2056,13 @@ bool LLAppViewer::cleanup() // Give any remaining SLPlugin instances a chance to exit cleanly. LLPluginProcessParent::shutdown(); + // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. + // disconnectViewer(); + // LLViewerCamera::deleteSingleton(); - disconnectViewer(); + // LL_INFOS() << "Viewer disconnected" << LL_ENDL; LLViewerCamera::deleteSingleton(); - - LL_INFOS() << "Viewer disconnected" << LL_ENDL; + // if (gKeyboard) { gKeyboard->resetKeys(); @@ -4865,7 +4865,8 @@ void LLAppViewer::removeDumpDir() void LLAppViewer::forceQuit() { // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. - persistCachesAndSettings(); + disconnectViewer(); + LL_INFOS() << "Viewer disconnected" << LL_ENDL; // LLApp::setQuitting(); } @@ -6364,48 +6365,14 @@ 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()); // 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;// [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. // // Cleanup after quitting. // @@ -6435,32 +6402,30 @@ void LLAppViewer::disconnectViewer() { LLSelectMgr::getInstance()->deselectAll(); } - // [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()); - // } - // } - // LLAvatarNameCache::instance().setCustomNameCheckCallback(LLAvatarNameCache::custom_name_check_callback_t()); // Contact sets - // saveNameCache(); - // if (LLExperienceCache::instanceExists()) - // { - // // TODO: LLExperienceCache::cleanup() logic should be moved to - // // cleanupSingleton(). - // LLExperienceCache::instance().cleanup(); - // } + // 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()); // Contact sets + saveNameCache(); + if (LLExperienceCache::instanceExists()) + { + // TODO: LLExperienceCache::cleanup() logic should be moved to + // cleanupSingleton(). + LLExperienceCache::instance().cleanup(); + } - // // close inventory interface, close all windows LLSidepanelInventory::cleanup(); @@ -6490,7 +6455,7 @@ void LLAppViewer::disconnectViewer() LLDestroyClassList::instance().fireCallbacks(); cleanup_xfer_manager(); - gDisconnected = TRUE; + // gDisconnected = TRUE; // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. // Pass the connection state to LLUrlEntryParcel not to attempt // parcel info requests while disconnected. diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index c548e3c5b8..323cd21c5a 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -287,7 +287,6 @@ private: void idleNetwork(); void sendLogoutRequest(); - void persistCachesAndSettings(); void disconnectViewer(); // *FIX: the app viewer class should be some sort of singleton, no?