Skip to content

Commit

Permalink
Bug 1297820 - Check if we have a nsIWidget before using NS_NATIVE_OPE…
Browse files Browse the repository at this point in the history
…NGL_CONTEXT. r=jgilbert

MozReview-Commit-ID: 5qmYkOoPMSo
  • Loading branch information
Ryan Hunt committed Aug 25, 2016
1 parent 7ec8858 commit e5acc58
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gfx/layers/opengl/CompositorOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ CompositorOGL::CreateContext()
RefPtr<GLContext> context;

// Used by mock widget to create an offscreen context
void* widgetOpenGLContext = mWidget->RealWidget()->GetNativeData(NS_NATIVE_OPENGL_CONTEXT);
nsIWidget* widget = mWidget->RealWidget();
void* widgetOpenGLContext = widget ? widget->GetNativeData(NS_NATIVE_OPENGL_CONTEXT) : nullptr;
if (widgetOpenGLContext) {
GLContext* alreadyRefed = reinterpret_cast<GLContext*>(widgetOpenGLContext);
return already_AddRefed<GLContext>(alreadyRefed);
Expand Down Expand Up @@ -144,7 +145,8 @@ CompositorOGL::CreateContext()
}

#ifdef MOZ_WIDGET_GONK
mWidget->RealWidget()->SetNativeData(
MOZ_ASSERT(widget);
widget->SetNativeData(
NS_NATIVE_OPENGL_CONTEXT, reinterpret_cast<uintptr_t>(context.get()));
#endif

Expand Down

0 comments on commit e5acc58

Please sign in to comment.