Hold some strong references on nsRefreshDriver

This commit is contained in:
Moonchild 2022-10-26 08:05:04 +00:00 • committed by roytam1
commit e69b52eac1
2 changed files with 6 additions and 3 deletions

View file

@ -2409,7 +2409,7 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
nsPresContext* presContext = GetPresContext(); nsPresContext* presContext = GetPresContext();
if (presContext) { if (presContext) {
nsRefreshDriver* driver = presContext->RefreshDriver(); RefPtr<nsRefreshDriver> driver = presContext->RefreshDriver();
driver->AdvanceTimeAndRefresh(aMilliseconds); driver->AdvanceTimeAndRefresh(aMilliseconds);
RefPtr<LayerTransactionChild> transaction = GetLayerTransaction(); RefPtr<LayerTransactionChild> transaction = GetLayerTransaction();

View file

@ -212,9 +212,12 @@ SVGDocumentWrapper::TickRefreshDriver()
nsCOMPtr<nsIPresShell> presShell; nsCOMPtr<nsIPresShell> presShell;
mViewer->GetPresShell(getter_AddRefs(presShell)); mViewer->GetPresShell(getter_AddRefs(presShell));
if (presShell) { if (presShell) {
nsPresContext* presContext = presShell->GetPresContext(); RefPtr<nsPresContext> presContext = presShell->GetPresContext();
if (presContext) { if (presContext) {
presContext->RefreshDriver()->DoTick(); RefPtr<nsRefreshDriver> driver = presContext->RefreshDriver();
if (driver) {
driver->DoTick();
}
} }
} }
} }