diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 5b10a43a0a..7e4d01b2e8 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1773,7 +1773,9 @@ bool LLAppViewer::doFrame() { LLVoiceClient::getInstance()->terminate(); } - + // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. + persistCachesAndSettings(); + // disconnectViewer(); resumeMainloopTimeout(); } @@ -2056,13 +2058,11 @@ 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(); - // LL_INFOS() << "Viewer disconnected" << LL_ENDL; + disconnectViewer(); LLViewerCamera::deleteSingleton(); - // + + LL_INFOS() << "Viewer disconnected" << LL_ENDL; if (gKeyboard) { gKeyboard->resetKeys(); @@ -4865,8 +4865,7 @@ void LLAppViewer::removeDumpDir() void LLAppViewer::forceQuit() { // [FIRE-32453] [BUG-232971] disconnect sooner to force the cache write. - disconnectViewer(); - LL_INFOS() << "Viewer disconnected" << LL_ENDL; + persistCachesAndSettings(); // 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()); // 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. // @@ -6402,30 +6435,32 @@ 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()); + // } + // } - // 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(); - } + // 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(); @@ -6455,7 +6490,7 @@ void LLAppViewer::disconnectViewer() LLDestroyClassList::instance().fireCallbacks(); cleanup_xfer_manager(); - // gDisconnected = TRUE; // [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. diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 323cd21c5a..c548e3c5b8 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -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?