Bug 1547760 - Ensuring UiCompositorControllerChild::mWidget alive when it is used

Differential Revision: https://phabricator.services.mozilla.com/D35166
This commit is contained in:
sotaro 2019-06-18 09:44:52 +09:00
Родитель 7ac9159761
Коммит 5f8fe2e910
2 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -13,6 +13,7 @@
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/StaticPtr.h"
#include "nsBaseWidget.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#if defined(MOZ_WIDGET_ANDROID)
@ -184,7 +185,12 @@ void UiCompositorControllerChild::Destroy() {
if (mIsOpen) {
// Close the underlying IPC channel.
mWidget = nullptr;
// Dispatch mWidget to main thread to prevent it from being destructed by
// the ui thread.
RefPtr<nsIWidget> widget = mWidget.forget();
NS_ReleaseOnMainThreadSystemGroup("UiCompositorControllerChild::mWidget",
widget.forget());
PUiCompositorControllerChild::Close();
mIsOpen = false;
}

Просмотреть файл

@ -78,7 +78,7 @@ class UiCompositorControllerChild final
Maybe<int32_t> mMaxToolbarHeight;
Maybe<uint32_t> mDefaultClearColor;
Maybe<bool> mLayerUpdateEnabled;
nsBaseWidget* mWidget;
RefPtr<nsBaseWidget> mWidget;
// Should only be set when compositor is in process.
RefPtr<UiCompositorControllerParent> mParent;
};