From 3ff25e7956764a64b6701b47be25ecf15a387b60 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sat, 19 May 2001 16:05:10 +0000 Subject: [PATCH] Fix gcc 2.7.2.3 crash on startup (orange on speedracer and worms tinderboxes). gcc 2.7.2.3 doesn't seem to follow the rule in C++ 12.2, clause 5, on the lifetime of temporaries bound to references. --- dom/src/base/nsScriptNameSpaceManager.cpp | 2 +- dom/src/build/nsScriptNameSpaceManager.cpp | 2 +- profile/src/nsProfile.cpp | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dom/src/base/nsScriptNameSpaceManager.cpp b/dom/src/base/nsScriptNameSpaceManager.cpp index c768027f8a5..fa771e5c8d2 100644 --- a/dom/src/base/nsScriptNameSpaceManager.cpp +++ b/dom/src/base/nsScriptNameSpaceManager.cpp @@ -95,7 +95,7 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager, continue; } - const nsAString& temp = NS_ConvertASCIItoUCS2(categoryEntry); + NS_ConvertASCIItoUCS2 temp(categoryEntry); // XXX Mac chokes _later_ if we put the |NS_Conv...| right in the |nsStringKey| ctor, so make a temp nsStringKey key(temp); diff --git a/dom/src/build/nsScriptNameSpaceManager.cpp b/dom/src/build/nsScriptNameSpaceManager.cpp index c768027f8a5..fa771e5c8d2 100644 --- a/dom/src/build/nsScriptNameSpaceManager.cpp +++ b/dom/src/build/nsScriptNameSpaceManager.cpp @@ -95,7 +95,7 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager, continue; } - const nsAString& temp = NS_ConvertASCIItoUCS2(categoryEntry); + NS_ConvertASCIItoUCS2 temp(categoryEntry); // XXX Mac chokes _later_ if we put the |NS_Conv...| right in the |nsStringKey| ctor, so make a temp nsStringKey key(temp); diff --git a/profile/src/nsProfile.cpp b/profile/src/nsProfile.cpp index be842f5f84e..b06e7993ab7 100644 --- a/profile/src/nsProfile.cpp +++ b/profile/src/nsProfile.cpp @@ -973,7 +973,9 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile) NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); nsISupports *subject = (nsISupports *)((nsIProfile *)this); - const nsAFlatString& context = isSwitch ? NS_LITERAL_STRING("switch") : NS_LITERAL_STRING("startup"); + NS_NAMED_LITERAL_STRING(switchString, "switch"); + NS_NAMED_LITERAL_STRING(startupString, "startup"); + const nsAFlatString& context = isSwitch ? switchString : startupString; if (isSwitch) { @@ -1050,7 +1052,10 @@ NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType) NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); nsISupports *subject = (nsISupports *)((nsIProfile *)this); - const nsAFlatString& context = (shutDownType == SHUTDOWN_CLEANSE) ? NS_LITERAL_STRING("shutdown-cleanse") : NS_LITERAL_STRING("shutdown-persist"); + + NS_NAMED_LITERAL_STRING(cleanseString, "shutdown-cleanse"); + NS_NAMED_LITERAL_STRING(persistString, "shutdown-persist"); + const nsAFlatString& context = (shutDownType == SHUTDOWN_CLEANSE) ? cleanseString : persistString; // Phase 1: See if anybody objects to the profile being changed. mProfileChangeVetoed = PR_FALSE;