{"record":{"id":"dec41c8612aba852","repo":"wasabeef/android-gpuimage","slug":"egldisplay-not-initialized","errorCode":null,"errorMessage":"eglDisplay not initialized","messagePattern":"eglDisplay not initialized","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java","lineNumber":965,"sourceCode":"\n        /**\n         * Create an egl surface for the current SurfaceHolder surface. If a surface\n         * already exists, destroy it before creating the new surface.\n         *\n         * @return true if the surface was created successfully.\n         */\n        public boolean createSurface() {\n            if (LOG_EGL) {\n                Log.w(\"EglHelper\", \"createSurface()  tid=\" + Thread.currentThread().getId());\n            }\n            /*\n             * Check preconditions.\n             */\n            if (egl == null) {\n                throw new RuntimeException(\"egl not initialized\");\n            }\n            if (eglDisplay == null) {\n                throw new RuntimeException(\"eglDisplay not initialized\");\n            }\n            if (eglConfig == null) {\n                throw new RuntimeException(\"eglConfig not initialized\");\n            }\n\n            /*\n             *  The window size has changed, so we need to create a new\n             *  surface.\n             */\n            destroySurfaceImp();\n\n            /*\n             * Create an EGL surface we can render into.\n             */\n            GLTextureView view = glTextureViewWeakRef.get();\n            if (view != null) {\n                eglSurface = view.eglWindowSurfaceFactory.createWindowSurface(egl, eglDisplay, eglConfig,\n                        view.getSurfaceTexture());","sourceCodeStart":947,"sourceCodeEnd":983,"githubUrl":"https://github.com/wasabeef/android-gpuimage/blob/ceea576ec931c2968431ad46f1fb2e6d68a542e2/library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java#L947-L983","documentation":"This RuntimeException is a precondition guard inside EglHelper.createSurface(): it fires when createSurface() is called before start() has successfully initialized the EGL objects, leaving eglDisplay null. It is a generic sentinel check — the input at fault is the helper's uninitialized state, typically caused by calling createSurface() out of order (e.g., before start()) or after a failed/aborted start() that never reached eglDisplay = egl.eglGetDisplay(). Callers must ensure start() succeeds before requesting surface creation.","triggerScenarios":"createSurface() runs while eglDisplay == null: start() aborted at eglGetDisplay/eglInitialize, or stop() nulls state while a createSurface request was already queued on the GL thread.","commonSituations":"Activity paused/destroyed racing GLThread startup, EglHelper.start() exception being caught and ignored, calling surface-creation paths after stop().","solutions":["Verify start() succeeded (check logs for 'eglGetDisplay/Initialize failed') before creating surfaces","Synchronize EglHelper lifecycle; cancel pending createSurface when stop() runs","Re-run start() if display is null and the view is still attached","Don't reuse EglHelper after stop(); create a fresh instance per render thread"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (eglDisplay == null) { /* re-run start() or abort createSurface */ }","typeGuard":null,"tryCatchPattern":"// catch (RuntimeException e) { reinitialize EglHelper if view still attached; else exit GL thread quietly }","preventionTips":["Guard all EglHelper calls with a started flag","Handle Activity pause/destroy racing GLThread startup","Create a fresh EglHelper per render-thread lifetime"],"tags":["egl","android","opengl","lifecycle","display-init"],"backgroundTag":"invalid-state-transition","analyzedSha":"ceea576ec931c2968431ad46f1fb2e6d68a542e2","analyzedAt":"2026-09-11T16:56:13.742Z","contentChangedAt":"2026-09-11T16:56:13.742Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}