Bug 1609732 Pause renderer before hiding gtkwindow to avoid crashes in webrender; r=stransky

Calling gtk_window_hide without pausing renderer cause crashes. Also to avoid repeated calls of NativeMoveResizeWaylandPopup from NativeMoveResizeWaylandPopup we don't call
Resize or Move anymore, we just update mBounds which is enough.

Differential Revision: https://phabricator.services.mozilla.com/D61312

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan Horak 2020-02-03 13:58:58 +00:00
Родитель 782a1ddc9e
Коммит 8da98936d8
2 изменённых файлов: 17 добавлений и 13 удалений

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

@ -1386,10 +1386,10 @@ void nsWindow::NativeMoveResizeWaylandPopupCB(const GdkRectangle* aFinalSize,
}
if (needsPositionUpdate && needsSizeUpdate) {
Resize(newBounds.x, newBounds.y, newBounds.width, newBounds.height, true);
mBounds = newBounds;
NotifyWindowMoved(newBounds.x, newBounds.y);
} else if (needsPositionUpdate) {
Move(newBounds.x, newBounds.y);
mBounds = newBounds;
NotifyWindowMoved(newBounds.x, newBounds.y);
} else {
Resize(newBounds.width, newBounds.height, true);
@ -1476,6 +1476,7 @@ void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition,
bool isWidgetVisible =
(sGtkWidgetIsVisible != nullptr) && sGtkWidgetIsVisible(mShell);
if (isWidgetVisible) {
PauseRemoteRenderer();
gtk_widget_hide(mShell);
}
@ -4497,16 +4498,7 @@ void nsWindow::NativeMoveResize() {
}
}
void nsWindow::HideWaylandWindow() {
#ifdef MOZ_WAYLAND
if (mWindowType == eWindowType_popup) {
LOG(("nsWindow::HideWaylandWindow: popup [%p]\n", this));
GList* foundWindow = g_list_find(gVisibleWaylandPopupWindows, this);
if (foundWindow) {
gVisibleWaylandPopupWindows =
g_list_delete_link(gVisibleWaylandPopupWindows, foundWindow);
}
}
void nsWindow::PauseRemoteRenderer() {
if (!mIsDestroyed) {
if (mContainer && moz_container_has_wl_egl_window(mContainer)) {
// Because wl_egl_window is destroyed on moz_container_unmap(),
@ -4528,7 +4520,18 @@ void nsWindow::HideWaylandWindow() {
}
}
}
#endif
}
void nsWindow::HideWaylandWindow() {
if (mWindowType == eWindowType_popup) {
LOG(("nsWindow::HideWaylandWindow: popup [%p]\n", this));
GList* foundWindow = g_list_find(gVisibleWaylandPopupWindows, this);
if (foundWindow) {
gVisibleWaylandPopupWindows =
g_list_delete_link(gVisibleWaylandPopupWindows, foundWindow);
}
}
PauseRemoteRenderer();
gtk_widget_hide(mShell);
}

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

@ -681,6 +681,7 @@ class nsWindow final : public nsBaseWidget {
bool IsMainMenuWindow();
GtkWidget* ConfigureWaylandPopupWindows();
void PauseRemoteRenderer();
void HideWaylandWindow();
void HideWaylandTooltips();
void HideWaylandPopupAndAllChildren();