mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
fix for #88876.
when I fixed the crasher (by going from keeping the bundle as a static COMPtr to member variable) I forgot to remove the code that only allocated one bundle. this caused it to assert when there were two or more nsMsgStatusFeedBack instances, and worse, they other instances wouldn't work. r=varada, sr=bienvenu
This commit is contained in:
parent
1f36272423
commit
2f71e7646c
@ -40,32 +40,24 @@
|
||||
|
||||
#define MSGFEEDBACK_TIMER_INTERVAL 500
|
||||
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
nsrefcnt nsMsgStatusFeedback::gInstanceCount = 0;
|
||||
|
||||
nsMsgStatusFeedback::nsMsgStatusFeedback() :
|
||||
m_lastPercent(0)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
LL_I2L(m_lastProgressTime, 0);
|
||||
|
||||
if (gInstanceCount++ == 0) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(kStringBundleServiceCID, &rv);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
if (NS_SUCCEEDED(rv))
|
||||
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
|
||||
getter_AddRefs(mBundle));
|
||||
}
|
||||
}
|
||||
|
||||
nsMsgStatusFeedback::~nsMsgStatusFeedback()
|
||||
{
|
||||
if (gInstanceCount-- == 0) {
|
||||
mBundle = nsnull;
|
||||
}
|
||||
mBundle = nsnull;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgStatusFeedback);
|
||||
@ -257,7 +249,7 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ct
|
||||
nsresult aStatus, const PRUnichar* aStatusArg)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(kStringBundleServiceCID, &rv);
|
||||
nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsXPIDLString str;
|
||||
rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str));
|
||||
|
@ -61,7 +61,6 @@ protected:
|
||||
// will replace this very C++ class you are looking at.
|
||||
nsCOMPtr<nsIMsgStatusFeedback> mStatusFeedback;
|
||||
|
||||
static nsrefcnt gInstanceCount;
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user