Potential serious threading issue in Android backend?

I’m trying to understand how SDL’s Android backend works and I’m a little confused because when the Java activity’s surfaceDestroyed() method is called, the following code is executed via JNI on the C side:

if (data->egl_surface != EGL_NO_SURFACE) {
    SDL_EGL_MakeCurrent(_this, NULL, NULL);
    SDL_EGL_DestroySurface(_this, data->egl_surface);
    data->egl_surface = EGL_NO_SURFACE;

What worries me here is the fact that the code above is executed on the Java thread whereas SDL_main() runs on its own thread which of course may access “data->egl_surface” all the time.

So can’t it happen that the code above is run at the very same time as “data->egl_surface” is accessed on the thread that runs SDL_main() and then the app goes belly up?

Or am I missing something here? To me it looks like “data->egl_surface” maybe accessed from both the Java thread and the SDL_main() thread without any synchronization mechanism at all?!