Bug 1271100 - Work around race in system Cairo's XShm usage. r=karlt, a=gchang
authorLee Salzman <lsalzman@mozilla.com>
Tue, 29 Nov 2016 23:01:13 -0500
changeset 352796 a6c49cbc91512b8824ee33102ebb0a36d069984d
parent 352795 c1681c600fd11590ad9f48c0ac14ccceb63f7d6b
child 352797 379652ddad1fc98c9da5c95e4289e3de9459b143
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, gchang
bugs1271100
milestone52.0a2
Bug 1271100 - Work around race in system Cairo's XShm usage. r=karlt, a=gchang MozReview-Commit-ID: VGee6ungCz
widget/gtk/mozgtk/mozgtk.c
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -607,8 +607,27 @@ 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
+
+#ifndef GTK3_SYMBOLS
+// Only define the following workaround when using GTK3, which we detect
+// by checking if GTK3 stubs are not provided.
+#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;
+}
+#endif
+