Module: wine
Branch: master
Commit: 35193586f78863810f6bb886abca2bc940890acd
URL: https://gitlab.winehq.org/wine/wine/-/commit/35193586f78863810f6bb886abca2b…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com>
Date: Wed Jul 19 17:25:46 2023 +0800
winex11.drv: Move the dummy parent window to (0, 0).
Move the dummy parent window from (-1, -1) to (0, 0) so that the window is considered visible by
Wayland. The X11 window region is set to an empty rectangle so that the window is still in fact
invisible. If Xshape support is not compiled in, then fall back to using (-1, -1).
This fixes poor performance when running Office 2016 on Xwayland. It's caused by glXWaitForSbcOML()
in glxdrv_wglSwapBuffers() taking 1 second every time it gets called. The timeout is from
TIMER_LEN_FLIP (1000ms) in xwl_present_reset_timer() in the xserver source code hw/xwayland/xwayland-present.c.
Xwayland doesn't actually know when a frame is visible on screen[1][2]. It relies on a timer to
simulate the process and when the window is invisible it uses a timer with a 1000ms timeout. This
patch makes the dummy parent window visible so that Xwayland will use the timer with a 17ms timeout(~60fps),
which also means that there will still be a 60fps limit for some windows when running on Xwayland.
[1]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/971
[2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/973
---
dlls/winex11.drv/window.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 14490ecd028..9ada6a63d59 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1512,9 +1512,22 @@ Window get_dummy_parent(void)
attrib.override_redirect = True;
attrib.border_pixel = 0;
attrib.colormap = default_colormap;
+
+#ifdef HAVE_LIBXSHAPE
+ {
+ static XRectangle empty_rect;
+ dummy_parent = XCreateWindow( gdi_display, root_window, 0, 0, 1, 1, 0,
+ default_visual.depth, InputOutput, default_visual.visual,
+ CWColormap | CWBorderPixel | CWOverrideRedirect, &attrib );
+ XShapeCombineRectangles( gdi_display, dummy_parent, ShapeBounding, 0, 0, &empty_rect, 1,
+ ShapeSet, YXBanded );
+ }
+#else
dummy_parent = XCreateWindow( gdi_display, root_window, -1, -1, 1, 1, 0, default_visual.depth,
InputOutput, default_visual.visual,
CWColormap | CWBorderPixel | CWOverrideRedirect, &attrib );
+ WARN("Xshape support is not compiled in. Applications under XWayland may have poor performance.");
+#endif
XMapWindow( gdi_display, dummy_parent );
}
return dummy_parent;
Module: wine
Branch: master
Commit: 8713e2ad6497e6eba63a4dd7136d47a80a430815
URL: https://gitlab.winehq.org/wine/wine/-/commit/8713e2ad6497e6eba63a4dd7136d47…
Author: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Date: Tue Jul 18 20:44:07 2023 +0300
mshtml: Grab the binding while aborting it.
Holding the BindStatusCallback ref is not enough; Abort can end up calling
OnStopBinding which intentionally removes the binding and releases its
ref. urlmon's Abort will then have a use-after-free when accessing the
state to set BINDING_ABORTED, if it was destroyed.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
---
dlls/mshtml/navigate.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index 4706167875e..112b63ba4b1 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -1993,10 +1993,16 @@ void abort_window_bindings(HTMLInnerWindow *window)
IBindStatusCallback_AddRef(&iter->IBindStatusCallback_iface);
- if(iter->binding)
- IBinding_Abort(iter->binding);
- else
+ if(iter->binding) {
+ IBinding *binding = iter->binding;
+
+ /* Abort can end up calling our OnStopBinding, which releases the binding. */
+ IBinding_AddRef(binding);
+ IBinding_Abort(binding);
+ IBinding_Release(binding);
+ }else {
iter->vtbl->stop_binding(iter, E_ABORT);
+ }
iter->window = NULL;
list_remove(&iter->entry);