# Anyone met this kind of error ? ERROR: SetCurrentContext eglMakeCurrent failed : 0x300d (EGL\_BAD\_SURFACE)

**URL:** <https://forums.unrealengine.com/t/anyone-met-this-kind-of-error-error-setcurrentcontext-eglmakecurrent-failed-0x300d-egl-bad-surface/238128>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [June 30, 2021, 1:53am UTC](https://forums.unrealengine.com/t/anyone-met-this-kind-of-error-error-setcurrentcontext-eglmakecurrent-failed-0x300d-egl-bad-surface/238128 "2021-06-30T01:53:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpu2015](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gpu2015](https://forums.unrealengine.com/u/gpu2015)\
**Post date:** [June 30, 2021, 1:53am UTC](https://forums.unrealengine.com/t/anyone-met-this-kind-of-error-error-setcurrentcontext-eglmakecurrent-failed-0x300d-egl-bad-surface/238128/1 "2021-06-30T01:53:12Z")

</div>

anyone met this kind of error ? ERROR: SetCurrentContext eglMakeCurrent failed : 0x300d (EGL\_BAD\_SURFACE)

* * *

AndroidEGL:: ReleaseContextOwnership, thread releasing rendering context tid: 6565

AndroidEGL::ResetDisplay()

\*\*\* JavaEnvDestructor: 6565

Assertion failed: Result == 1 [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/OpenGLDrv/Private/Android/AndroidEGL.cpp] [Line: 241]

ERROR: SetCurrentContext eglMakeCurrent failed : 0x300d

(0x300d == EGL\_BAD\_SURFACE )

* * *

SetRHIThreadEnabled(false, false);//this is set in my code.

* * *

added debug code in the engine, and fail before call SetCurrentContext…

void AndroidEGL::SetCurrentRenderingContext()

{

```
PImplData->CurrentContextType = CONTEXT_Rendering;

if (GUseThreadedRendering)

{

    checkf(PImplData->RenderingContext.eglContext != EGL_NO_CONTEXT, TEXT("ERROR: PImplData->RenderingContext.eglContext == EGL_NO_CONTEXT"));//OK

    checkf(PImplData->RenderingContext.eglSurface != EGL_NO_SURFACE, TEXT("ERROR: PImplData->RenderingContext.eglSurface == EGL_NO_SURFACE"));//OK

    EGLint x;

    EGLBoolean r = eglQuerySurface(PImplData->eglDisplay, PImplData->RenderingContext.eglSurface, EGL_TEXTURE_FORMAT, &x);

    checkf(r == EGL_TRUE, TEXT("EGL_TEXTURE_FORMAT, PImplData->RenderingContext.eglSurface error : 0x%x"), eglGetError());//fail here....

    SetCurrentContext(PImplData->RenderingContext.eglContext, PImplData->RenderingContext.eglSurface);

}

```

}
