зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1510058 - Work around mWidget becoming null during DidComposite, and add a diagnostic assert that will hopefully root out the culprit. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D13309 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f0bf48464f
Коммит
2e2c28e9f6
|
@ -58,6 +58,7 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
|||
, mCompositorMightResample(false)
|
||||
, mNeedsComposite(false)
|
||||
, mQueuedAsyncPaints(false)
|
||||
, mNotifyingWidgetListener(false)
|
||||
, mPaintSequenceNumber(0)
|
||||
, mForwarder(new ShadowLayerForwarder(this))
|
||||
{
|
||||
|
@ -85,6 +86,9 @@ ClientLayerManager::~ClientLayerManager()
|
|||
void
|
||||
ClientLayerManager::Destroy()
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mNotifyingWidgetListener,
|
||||
"Try to avoid destroying widgets and layer managers during DidCompositeWindow, if you can");
|
||||
|
||||
// It's important to call ClearCachedResource before Destroy because the
|
||||
// former will early-return if the later has already run.
|
||||
ClearCachedResources();
|
||||
|
@ -495,12 +499,19 @@ ClientLayerManager::DidComposite(TransactionId aTransactionId,
|
|||
if (aTransactionId.IsValid()) {
|
||||
nsIWidgetListener *listener = mWidget->GetWidgetListener();
|
||||
if (listener) {
|
||||
mNotifyingWidgetListener = true;
|
||||
listener->DidCompositeWindow(aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
mNotifyingWidgetListener = false;
|
||||
}
|
||||
// DidCompositeWindow might have called Destroy on us and nulled out mWidget,
|
||||
// see bug 1510058.
|
||||
// Re-check it here.
|
||||
if (mWidget) {
|
||||
listener = mWidget->GetAttachedWidgetListener();
|
||||
if (listener) {
|
||||
listener->DidCompositeWindow(aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
}
|
||||
}
|
||||
if (mTransactionIdAllocator) {
|
||||
mTransactionIdAllocator->NotifyTransactionCompleted(aTransactionId);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ private:
|
|||
bool mCompositorMightResample;
|
||||
bool mNeedsComposite;
|
||||
bool mQueuedAsyncPaints;
|
||||
bool mNotifyingWidgetListener;
|
||||
|
||||
// An incrementing sequence number for paints.
|
||||
// Incremented in BeginTransaction(), but not for repeat transactions.
|
||||
|
|
Загрузка…
Ссылка в новой задаче