зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1535874 - Don't clear out nsStyleSheetService::gInstance when random other nsStyleSheetService objects are destroyed. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D23815 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7c21782019
Коммит
e90bcb5786
|
@ -2299,6 +2299,10 @@ UniquePtr<ServoStyleSet> nsDocumentViewer::CreateStyleSet(Document* aDocument) {
|
|||
auto cache = nsLayoutStylesheetCache::Singleton();
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
|
||||
MOZ_ASSERT(sheetService,
|
||||
"should never be creating a StyleSet after the style sheet "
|
||||
"service has gone");
|
||||
|
||||
auto styleSet = MakeUnique<ServoStyleSet>();
|
||||
|
||||
// User sheets
|
||||
|
|
|
@ -36,14 +36,18 @@ nsStyleSheetService::nsStyleSheetService() {
|
|||
"Convention for Style Sheet");
|
||||
NS_ASSERTION(!gInstance,
|
||||
"Someone is using CreateInstance instead of GetService");
|
||||
gInstance = this;
|
||||
if (!gInstance) {
|
||||
gInstance = this;
|
||||
}
|
||||
nsLayoutStatics::AddRef();
|
||||
}
|
||||
|
||||
nsStyleSheetService::~nsStyleSheetService() {
|
||||
UnregisterWeakMemoryReporter(this);
|
||||
|
||||
gInstance = nullptr;
|
||||
if (gInstance == this) {
|
||||
gInstance = nullptr;
|
||||
}
|
||||
nsLayoutStatics::Release();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче