fune/widget/gtk/mozgtk/mozgtk.c
Mike Hommey 8bf0782758 Bug 1707834 - Avoid libmozgtk not being linked to libxul. r=firefox-build-system-reviewers,mhentges
When the linker defaults to --as-needed, libmozgtk ends up not linked
to libxul because libxul doesn't use anything from it.
We solve the problem by adding a symbol to mozgtk and have libxul use
it.

In bug 1377445, we moved XShmQueryExtension to mozglue. While libxul
currently doesn't use the symbol (it's a workaround for system
libraries), we can move the function back to mozgtk and add a dummy
call.

Differential Revision: https://phabricator.services.mozilla.com/D113487
2021-04-27 21:44:22 +00:00

21 lines
1.1 KiB
C

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Types.h"
#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.
//
// This is also used to force libxul to depend on the mozgtk library. If we
// ever can remove this workaround for system Cairo, we'll need something
// to replace it for that purpose.
MOZ_EXPORT Bool XShmQueryExtension(Display* aDisplay) { return False; }