diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 9a1157f330cb..03df3c6d7014 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -823,7 +823,7 @@ GLContextGLX::CreateGLContext(CreateContextFlags flags, const SurfaceCaps& caps, RefPtr glContext; bool error; - OffMainThreadScopedXErrorHandler xErrorHandler; + ScopedXErrorHandler xErrorHandler; do { error = false; @@ -1311,7 +1311,7 @@ CreateOffscreenPixmapContext(CreateContextFlags flags, const IntSize& size, int depth; FindVisualAndDepth(display, visid, &visual, &depth); - OffMainThreadScopedXErrorHandler xErrorHandler; + ScopedXErrorHandler xErrorHandler; bool error = false; Drawable drawable; diff --git a/gfx/src/X11Util.cpp b/gfx/src/X11Util.cpp index 7dd02d2fd7a8..e1492be54511 100644 --- a/gfx/src/X11Util.cpp +++ b/gfx/src/X11Util.cpp @@ -57,15 +57,13 @@ ScopedXErrorHandler::ErrorHandler(Display *, XErrorEvent *ev) return 0; } -ScopedXErrorHandler::ScopedXErrorHandler(bool aAllowOffMainThread) +ScopedXErrorHandler::ScopedXErrorHandler() { - if (!aAllowOffMainThread) { - // Off main thread usage is not safe in general, but OMTC GL layers uses this - // with the main thread blocked, which makes it safe. - NS_WARNING_ASSERTION( + // Off main thread usage is not safe in general, but OMTC GL layers uses this + // with the main thread blocked, which makes it safe. + NS_WARNING_ASSERTION( NS_IsMainThread(), "ScopedXErrorHandler being called off main thread, may cause issues"); - } // let sXErrorPtr point to this object's mXError object, but don't reset this mXError object! // think of the case of nested ScopedXErrorHandler's. mOldXErrorPtr = sXErrorPtr; diff --git a/gfx/src/X11Util.h b/gfx/src/X11Util.h index 83944d5c053c..dff855ff23f9 100644 --- a/gfx/src/X11Util.h +++ b/gfx/src/X11Util.h @@ -118,10 +118,7 @@ public: static int ErrorHandler(Display *, XErrorEvent *ev); - /** - * @param aAllowOffMainThread whether to warn if used off main thread - */ - ScopedXErrorHandler(bool aAllowOffMainThread = false); + ScopedXErrorHandler(); ~ScopedXErrorHandler(); @@ -134,15 +131,6 @@ public: bool SyncAndGetError(Display *dpy, XErrorEvent *ev = nullptr); }; -class OffMainThreadScopedXErrorHandler : public ScopedXErrorHandler -{ -public: - OffMainThreadScopedXErrorHandler() - : ScopedXErrorHandler(true) - { - } -}; - } // namespace mozilla #endif // mozilla_X11Util_h