LindenUserDir fixes.
Patch from 2010-10-20/22. Didn't apply cleanly so I redid it manually and tested/checked it. There was only one difference with imprudence: for some reason Singularity tries to see if the "teleport history" floater is visible while initializing the menu's, something that imprudence doesn't do. For the rest the patch is basically the same. Nevertheless, I left all code exactly as it was in Singularity (the only thing that this commit changes is the intend of the original patch: in debug mode, fail with an assertion when LindenUserDir is called while it is not initialized; and then fix everything to make it work again. Original commit message: The LindenUserDir (~/.imprudence/first_last/) cannot be initialized before the user logged in. However, several singletons (that only can be initialized once) depend on this directory for initialization. Therefore we have to take care not to instantiate those singletons until after the user logged in. With regard to webit, this fixes the browser_profile (cache and cookies) directory that the builtin browser uses.
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
#include "llimagegl.h"
|
||||
#include "llwindow.h"
|
||||
#include "lltextparser.h"
|
||||
#include "lldir.h"
|
||||
#include <queue>
|
||||
#include "llmenugl.h"
|
||||
#include "../newview/lgghunspell_wrapper.h"
|
||||
@@ -4004,7 +4005,10 @@ void LLTextEditor::appendColoredText(const std::string &new_text,
|
||||
const std::string& font_name)
|
||||
{
|
||||
LLColor4 lcolor=color;
|
||||
if (mParseHighlights)
|
||||
// If LindenUserDir is empty then we didn't login yet.
|
||||
// In that case we can't instantiate LLTextParser, which
|
||||
// is initialized per user.
|
||||
if (mParseHighlights && !gDirUtilp->getLindenUserDir(true).empty())
|
||||
{
|
||||
LLTextParser* highlight = LLTextParser::getInstance();
|
||||
highlight->parseFullLineHighlights(new_text, &lcolor);
|
||||
@@ -4082,7 +4086,10 @@ void LLTextEditor::appendHighlightedText(const std::string &new_text,
|
||||
S32 highlight_part,
|
||||
LLStyleSP stylep)
|
||||
{
|
||||
if (mParseHighlights)
|
||||
// If LindenUserDir is empty then we didn't login yet.
|
||||
// In that case we can't instantiate LLTextParser, which
|
||||
// is initialized per user.
|
||||
if (mParseHighlights && !gDirUtilp->getLindenUserDir(true).empty())
|
||||
{
|
||||
LLTextParser* highlight = LLTextParser::getInstance();
|
||||
|
||||
|
||||
@@ -193,8 +193,9 @@ const std::string &LLDir::getOSUserAppDir() const
|
||||
return mOSUserAppDir;
|
||||
}
|
||||
|
||||
const std::string &LLDir::getLindenUserDir() const
|
||||
const std::string &LLDir::getLindenUserDir(bool empty_ok) const
|
||||
{
|
||||
llassert(empty_ok || !mLindenUserDir.empty());
|
||||
return mLindenUserDir;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class LLDir
|
||||
const std::string &getAppRODataDir() const; // Location of read-only data files
|
||||
const std::string &getOSUserDir() const; // Location of the os-specific user dir
|
||||
const std::string &getOSUserAppDir() const; // Location of the os-specific user app dir
|
||||
const std::string &getLindenUserDir() const; // Location of the Linden user dir.
|
||||
const std::string &getLindenUserDir(bool empty_ok = false) const; // Location of the Linden user dir.
|
||||
const std::string &getChatLogsDir() const; // Location of the chat logs dir.
|
||||
const std::string &getPerAccountChatLogsDir() const; // Location of the per account chat logs dir.
|
||||
const std::string &getTempDir() const; // Common temporary directory
|
||||
|
||||
@@ -97,7 +97,7 @@ LLDir_Linux::LLDir_Linux()
|
||||
mAppRODataDir = tmp_str;
|
||||
mOSUserDir = getCurrentUserHome(tmp_str);
|
||||
mOSUserAppDir = "";
|
||||
mLindenUserDir = tmp_str;
|
||||
mLindenUserDir = "";
|
||||
|
||||
char path [32]; /* Flawfinder: ignore */
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ LLDir_Solaris::LLDir_Solaris()
|
||||
mAppRODataDir = strdup(tmp_str);
|
||||
mOSUserDir = getCurrentUserHome(tmp_str);
|
||||
mOSUserAppDir = "";
|
||||
mLindenUserDir = tmp_str;
|
||||
mLindenUserDir = "";
|
||||
|
||||
char path [LL_MAX_PATH]; /* Flawfinder: ignore */
|
||||
|
||||
|
||||
@@ -3202,12 +3202,15 @@ void LLAppViewer::saveFinalSnapshot()
|
||||
gSavedSettings.setBOOL("ShowParcelOwners", FALSE);
|
||||
idle();
|
||||
|
||||
std::string snap_filename = gDirUtilp->getLindenUserDir();
|
||||
snap_filename += gDirUtilp->getDirDelimiter();
|
||||
snap_filename += SCREEN_LAST_FILENAME;
|
||||
// use full pixel dimensions of viewer window (not post-scale dimensions)
|
||||
gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE);
|
||||
mSavedFinalSnapshot = TRUE;
|
||||
std::string snap_filename = gDirUtilp->getLindenUserDir(true);
|
||||
if (!snap_filename.empty())
|
||||
{
|
||||
snap_filename += gDirUtilp->getDirDelimiter();
|
||||
snap_filename += SCREEN_LAST_FILENAME;
|
||||
// use full pixel dimensions of viewer window (not post-scale dimensions)
|
||||
gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, TRUE);
|
||||
mSavedFinalSnapshot = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1347,7 +1347,7 @@ void LLIMMgr::saveIgnoreGroup()
|
||||
{
|
||||
// llinfos << "saving ignore_groups.xml" << llendl;
|
||||
|
||||
std::string user_dir = gDirUtilp->getLindenUserDir();
|
||||
std::string user_dir = gDirUtilp->getLindenUserDir(true);
|
||||
if (!user_dir.empty())
|
||||
{
|
||||
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");
|
||||
|
||||
@@ -264,7 +264,7 @@ LLMuteList::~LLMuteList()
|
||||
// If we quit from the login screen we will not have an SL account
|
||||
// name. Don't try to save, otherwise we'll dump a file in
|
||||
// C:\Program Files\SecondLife\ JC
|
||||
std::string user_dir = gDirUtilp->getLindenUserDir();
|
||||
std::string user_dir = gDirUtilp->getLindenUserDir(true);
|
||||
if (!user_dir.empty())
|
||||
{
|
||||
std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml");
|
||||
|
||||
@@ -1890,6 +1890,10 @@ bool idle_startup()
|
||||
gLLWindEnabled = gSavedSettings.getBOOL("WindEnabled");
|
||||
|
||||
set_startup_status(0.40f, LLTrans::getString("LoginInitializingWorld"), gAgent.mMOTD);
|
||||
|
||||
// Initialize the rest of the world.
|
||||
gViewerWindow->initWorldUI_postLogin();
|
||||
|
||||
display_startup();
|
||||
// We should have an agent id by this point.
|
||||
llassert(!(gAgentID == LLUUID::null));
|
||||
|
||||
@@ -74,7 +74,7 @@ bool LLURLHistory::loadFile(const std::string& filename)
|
||||
// static
|
||||
bool LLURLHistory::saveFile(const std::string& filename)
|
||||
{
|
||||
std::string temp_str = gDirUtilp->getLindenUserDir();
|
||||
std::string temp_str = gDirUtilp->getLindenUserDir(true);
|
||||
if( temp_str.empty() )
|
||||
{
|
||||
llwarns << "Can't save. No user directory set." << llendl;
|
||||
|
||||
@@ -6643,7 +6643,7 @@ class LLFloaterVisible : public view_listener_t
|
||||
}
|
||||
else if (floater_name == "teleport history")
|
||||
{
|
||||
new_value = gFloaterTeleportHistory->getVisible();
|
||||
new_value = (gFloaterTeleportHistory && gFloaterTeleportHistory->getVisible());
|
||||
}
|
||||
else if (floater_name == "im")
|
||||
{
|
||||
|
||||
@@ -1912,7 +1912,8 @@ void LLViewerWindow::initWorldUI()
|
||||
S32 width = mRootView->getRect().getWidth();
|
||||
LLRect full_window(0, height, width, 0);
|
||||
|
||||
if ( gBottomPanel == NULL ) // Don't re-enter if objects are alreay created
|
||||
// Don't re-enter if objects are alreay created
|
||||
if (gBottomPanel == NULL)
|
||||
{
|
||||
// panel containing chatbar, toolbar, and overlay, over floaters
|
||||
gBottomPanel = new LLBottomPanel(mRootView->getRect());
|
||||
@@ -1925,6 +1926,57 @@ void LLViewerWindow::initWorldUI()
|
||||
|
||||
gIMMgr = LLIMMgr::getInstance();
|
||||
|
||||
//
|
||||
// Tools for building
|
||||
//
|
||||
|
||||
init_menus();
|
||||
|
||||
// Toolbox floater
|
||||
gFloaterTools = new LLFloaterTools();
|
||||
gFloaterTools->setVisible(FALSE);
|
||||
}
|
||||
|
||||
if ( gHUDView == NULL )
|
||||
{
|
||||
LLRect hud_rect = full_window;
|
||||
hud_rect.mBottom += 50;
|
||||
if (gMenuBarView)
|
||||
{
|
||||
hud_rect.mTop -= gMenuBarView->getRect().getHeight();
|
||||
}
|
||||
gHUDView = new LLHUDView(hud_rect);
|
||||
// put behind everything else in the UI
|
||||
mRootView->addChildAtEnd(gHUDView);
|
||||
}
|
||||
}
|
||||
|
||||
// initWorldUI that wasn't before logging in. Some of this may require the access the 'LindenUserDir'.
|
||||
void LLViewerWindow::initWorldUI_postLogin()
|
||||
{
|
||||
S32 height = mRootView->getRect().getHeight();
|
||||
S32 width = mRootView->getRect().getWidth();
|
||||
LLRect full_window(0, height, width, 0);
|
||||
|
||||
// Don't re-enter if objects are alreay created.
|
||||
if (!gStatusBar)
|
||||
{
|
||||
// Status bar
|
||||
S32 menu_bar_height = gMenuBarView->getRect().getHeight();
|
||||
LLRect root_rect = getRootView()->getRect();
|
||||
LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height);
|
||||
gStatusBar = new LLStatusBar(std::string("status"), status_rect);
|
||||
gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
|
||||
|
||||
gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
|
||||
gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
|
||||
// sync bg color with menu bar
|
||||
gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
|
||||
getRootView()->addChild(gStatusBar);
|
||||
|
||||
// Menu holder appears on top to get first pass at all mouse events
|
||||
getRootView()->sendChildToFront(gMenuHolder);
|
||||
|
||||
if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
|
||||
{
|
||||
LLFloaterChat::getInstance(LLSD())->loadHistory();
|
||||
@@ -1950,47 +2002,7 @@ void LLViewerWindow::initWorldUI()
|
||||
gFloaterTeleportHistory = new LLFloaterTeleportHistory();
|
||||
gFloaterTeleportHistory->setVisible(FALSE);
|
||||
|
||||
//
|
||||
// Tools for building
|
||||
//
|
||||
|
||||
// Toolbox floater
|
||||
init_menus();
|
||||
|
||||
gFloaterTools = new LLFloaterTools();
|
||||
gFloaterTools->setVisible(FALSE);
|
||||
|
||||
// Status bar
|
||||
S32 menu_bar_height = gMenuBarView->getRect().getHeight();
|
||||
LLRect root_rect = getRootView()->getRect();
|
||||
LLRect status_rect(0, root_rect.getHeight(), root_rect.getWidth(), root_rect.getHeight() - menu_bar_height);
|
||||
gStatusBar = new LLStatusBar(std::string("status"), status_rect);
|
||||
gStatusBar->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP);
|
||||
|
||||
gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
|
||||
gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
|
||||
// sync bg color with menu bar
|
||||
gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
|
||||
|
||||
LLFloaterChatterBox::createInstance(LLSD());
|
||||
|
||||
getRootView()->addChild(gStatusBar);
|
||||
|
||||
// menu holder appears on top to get first pass at all mouse events
|
||||
getRootView()->sendChildToFront(gMenuHolder);
|
||||
}
|
||||
|
||||
if ( gHUDView == NULL )
|
||||
{
|
||||
LLRect hud_rect = full_window;
|
||||
hud_rect.mBottom += 50;
|
||||
if (gMenuBarView)
|
||||
{
|
||||
hud_rect.mTop -= gMenuBarView->getRect().getHeight();
|
||||
}
|
||||
gHUDView = new LLHUDView(hud_rect);
|
||||
// put behind everything else in the UI
|
||||
mRootView->addChildAtEnd(gHUDView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,7 @@ public:
|
||||
void adjustRectanglesForFirstUse(const LLRect& window);
|
||||
void adjustControlRectanglesForFirstUse(const LLRect& window);
|
||||
void initWorldUI();
|
||||
void initWorldUI_postLogin();
|
||||
|
||||
//
|
||||
// LLWindowCallback interface implementation
|
||||
|
||||
Reference in New Issue
Block a user