mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1018598 - Shutdown jump list thread correctly to avoid debug assertions. r=jimm
This commit is contained in:
parent
fce23807a0
commit
32b64d307f
@ -21,6 +21,7 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
#include "WinUtils.h"
|
||||
|
||||
@ -41,6 +42,7 @@ bool JumpListBuilder::sBuildingList = false;
|
||||
const char kPrefTaskbarEnabled[] = "browser.taskbar.lists.enabled";
|
||||
|
||||
NS_IMPL_ISUPPORTS(JumpListBuilder, nsIJumpListBuilder, nsIObserver)
|
||||
#define TOPIC_PROFILE_BEFORE_CHANGE "profile-before-change"
|
||||
|
||||
JumpListBuilder::JumpListBuilder() :
|
||||
mMaxItems(0),
|
||||
@ -56,11 +58,16 @@ JumpListBuilder::JumpListBuilder() :
|
||||
NS_LITERAL_CSTRING("Jump List"),
|
||||
LazyIdleThread::ManualShutdown);
|
||||
Preferences::AddStrongObserver(this, kPrefTaskbarEnabled);
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (observerService) {
|
||||
observerService->AddObserver(this, TOPIC_PROFILE_BEFORE_CHANGE, false);
|
||||
}
|
||||
}
|
||||
|
||||
JumpListBuilder::~JumpListBuilder()
|
||||
{
|
||||
mIOThread->Shutdown();
|
||||
Preferences::RemoveObserver(this, kPrefTaskbarEnabled);
|
||||
mJumpListMgr = nullptr;
|
||||
::CoUninitialize();
|
||||
@ -510,10 +517,19 @@ nsresult JumpListBuilder::TransferIObjectArrayToIMutableArray(IObjectArray *objA
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (nsDependentString(aData).EqualsASCII(kPrefTaskbarEnabled)) {
|
||||
NS_ENSURE_ARG_POINTER(aTopic);
|
||||
if (strcmp(aTopic, TOPIC_PROFILE_BEFORE_CHANGE) == 0) {
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
if (observerService) {
|
||||
observerService->RemoveObserver(this, TOPIC_PROFILE_BEFORE_CHANGE);
|
||||
}
|
||||
mIOThread->Shutdown();
|
||||
} else if (strcmp(aTopic, "nsPref:changed") == 0 &&
|
||||
nsDependentString(aData).EqualsASCII(kPrefTaskbarEnabled)) {
|
||||
bool enabled = Preferences::GetBool(kPrefTaskbarEnabled, true);
|
||||
if (!enabled) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user