forked from mirrors/gecko-dev
Bug 1882021 [Linux] Make sure GtkCompositorWidget::mWidget reference is released on nsWindow::Destroy() to avoid nsWindow leak r=emilio
Depends on D203104 Differential Revision: https://phabricator.services.mozilla.com/D203177
This commit is contained in:
parent
bc432c06b4
commit
de3474c44a
3 changed files with 15 additions and 1 deletions
|
|
@ -52,6 +52,16 @@ WindowSurfaceProvider::WindowSurfaceProvider()
|
|||
{
|
||||
}
|
||||
|
||||
WindowSurfaceProvider::~WindowSurfaceProvider() {
|
||||
#ifdef MOZ_WAYLAND
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mWidget,
|
||||
"nsWindow reference is still live, we're leaking it!");
|
||||
#endif
|
||||
#ifdef MOZ_X11
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mXWindow, "mXWindow should be released on quit!");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_WAYLAND
|
||||
void WindowSurfaceProvider::Initialize(RefPtr<nsWindow> aWidget) {
|
||||
mWindowSurfaceValid = false;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class GtkCompositorWidget;
|
|||
class WindowSurfaceProvider final {
|
||||
public:
|
||||
WindowSurfaceProvider();
|
||||
~WindowSurfaceProvider() = default;
|
||||
~WindowSurfaceProvider();
|
||||
|
||||
/**
|
||||
* Initializes the WindowSurfaceProvider by giving it the window
|
||||
|
|
|
|||
|
|
@ -615,6 +615,10 @@ void nsWindow::Destroy() {
|
|||
|
||||
DestroyLayerManager();
|
||||
|
||||
// mSurfaceProvider holds reference to this nsWindow so we need to explicitly
|
||||
// clear it here to avoid nsWindow leak.
|
||||
mSurfaceProvider.CleanupResources();
|
||||
|
||||
g_signal_handlers_disconnect_by_data(gtk_settings_get_default(), this);
|
||||
|
||||
if (mIMContext) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue