summaryrefslogtreecommitdiff
path: root/mozilla-1271100.patch
blob: ee76024f1445bd2f6d15c2ace543bf3c4605fd83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# HG changeset patch
# User Lee Salzman <lsalzman@mozilla.com>
# Date 1480470918 18000
#      Tue Nov 29 20:55:18 2016 -0500
# Node ID ffc92a98adee4c3ebb1f3b8c593e913a74ef6a4a
# Parent  8d8846f63b74eb930e48b410730ae088e9bdbee8
work around race in system Cairo's XShm usage

MozReview-Commit-ID: VGee6ungCz

diff --git a/widget/gtk/mozgtk/mozgtk.c b/widget/gtk/mozgtk/mozgtk.c
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -606,8 +606,23 @@ STUB(gdk_window_set_back_pixmap)
 STUB(gdk_x11_colormap_foreign_new)
 STUB(gdk_x11_colormap_get_xcolormap)
 STUB(gdk_x11_drawable_get_xdisplay)
 STUB(gdk_x11_drawable_get_xid)
 STUB(gdk_x11_window_get_drawable_impl)
 STUB(gdkx_visual_get)
 STUB(gtk_object_get_type)
 #endif
+
+#include <X11/Xlib.h>
+// Bug 1271100
+// We need to trick system Cairo into not using the XShm extension due to
+// a race condition in it that results in frequent BadAccess errors. Cairo
+// relies upon XShmQueryExtension to initially detect if XShm is available.
+// So we define our own stub that always indicates XShm not being present.
+// mozgtk loads before libXext/libcairo and so this stub will take priority.
+// Our tree usage goes through xcb and remains unaffected by this.
+MOZ_EXPORT Bool
+XShmQueryExtension(Display* aDisplay)
+{
+  return False;
+}
+
bgstack15