summaryrefslogtreecommitdiffstats
path: root/gfx/layers/composite/X11TextureHost.cpp
diff options
context:
space:
mode:
authorAndrew Osmond <aosmond@mozilla.com>2018-02-22 12:11:00 -0500
committerwolfbeast <mcwerewolf@gmail.com>2018-03-14 11:06:35 +0100
commitc0ea2166b946daaad3b2b85b68c5570f9f7822d7 (patch)
tree24800a260ae6e9c539f2ce0b5c24d9ba4f117685 /gfx/layers/composite/X11TextureHost.cpp
parent686954ea845a7b05a8bdb8d2ed9a002a88e698e6 (diff)
downloadUXP-c0ea2166b946daaad3b2b85b68c5570f9f7822d7.tar
UXP-c0ea2166b946daaad3b2b85b68c5570f9f7822d7.tar.gz
UXP-c0ea2166b946daaad3b2b85b68c5570f9f7822d7.tar.lz
UXP-c0ea2166b946daaad3b2b85b68c5570f9f7822d7.tar.xz
UXP-c0ea2166b946daaad3b2b85b68c5570f9f7822d7.zip
Bug 1388020. r=nical, a=RyanVM
Diffstat (limited to 'gfx/layers/composite/X11TextureHost.cpp')
-rw-r--r--gfx/layers/composite/X11TextureHost.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/gfx/layers/composite/X11TextureHost.cpp b/gfx/layers/composite/X11TextureHost.cpp
index 7ca42426d..92b6f8e91 100644
--- a/gfx/layers/composite/X11TextureHost.cpp
+++ b/gfx/layers/composite/X11TextureHost.cpp
@@ -22,10 +22,9 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
const SurfaceDescriptorX11& aDescriptor)
: TextureHost(aFlags)
{
- RefPtr<gfxXlibSurface> surface = aDescriptor.OpenForeign();
- mSurface = surface.get();
+ mSurface = aDescriptor.OpenForeign();
- if (!(aFlags & TextureFlags::DEALLOCATE_CLIENT)) {
+ if (mSurface && !(aFlags & TextureFlags::DEALLOCATE_CLIENT)) {
mSurface->TakePixmap();
}
}
@@ -33,7 +32,7 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
bool
X11TextureHost::Lock()
{
- if (!mCompositor) {
+ if (!mCompositor || !mSurface) {
return false;
}
@@ -69,6 +68,9 @@ X11TextureHost::SetCompositor(Compositor* aCompositor)
SurfaceFormat
X11TextureHost::GetFormat() const
{
+ if (!mSurface) {
+ return SurfaceFormat::UNKNOWN;
+ }
gfxContentType type = mSurface->GetContentType();
#ifdef GL_PROVIDER_GLX
if (mCompositor->GetBackendType() == LayersBackend::LAYERS_OPENGL) {
@@ -81,6 +83,9 @@ X11TextureHost::GetFormat() const
IntSize
X11TextureHost::GetSize() const
{
+ if (!mSurface) {
+ return IntSize();
+ }
return mSurface->GetSize();
}