2012-10-12 18 views
6

GLSurfaceView, eglCreateWindowSurface के साथ कुछ क्रियाएँ लॉन्च करने के दौरान जल्दी से बटन को दबाए जाने की कोशिश करते समय java.lang.IllegalArgumentException के साथ विफल रहता है।eglCreateWindowSurface java.lang.IllegalArgumentException

10-08 18:05:36.490: E/GLSurfaceView(3440): eglCreateWindowSurface 
10-08 18:05:36.490: E/GLSurfaceView(3440): java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface 
10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google.android.gles_jni.EGLImpl._eglCreateWindowSurface(Native Method) 
10-08 18:05:36.490: E/GLSurfaceView(3440): at com.google.android.gles_jni.EGLImpl.eglCreateWindowSurface(EGLImpl.java:90) 
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$DefaultWindowSurfaceFactory.createWindowSurface(GLSurfaceView.java:798) 
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$EglHelper.createSurface(GLSurfaceView.java:1065) 
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1433) 
10-08 18:05:36.490: E/GLSurfaceView(3440): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216) 

इन गतिविधियों SurfaceHolder.Callback.surfaceCreated से पहले या SurfaceHolder.Callback.surfaceDestroyed के बाद जीएल संचालन आह्वान नहीं किया:

मैं निम्न त्रुटियों मिला है।

क्या कोई और इसमें भाग लेता है, और समाधान क्या है?

किसी भी अग्रिम के लिए धन्यवाद।

उत्तर

11

एकाधिक क्रियाकलापों के बीच स्विचिंग जल्दी से खिड़की की सतह को तोड़ दिया।

मैं GLSurfaceView.guardedRun() समझौता से GLSurfaceView

की रेस स्थिति से बचने के लिए:

   if (createEglSurface) { 
        if (LOG_SURFACE) { 
         Log.w("GLThread", "egl createSurface"); 
        } 
        gl = (GL10) mEglHelper.createSurface(getHolder()); 
        if (gl == null) { 
         // Couldn't create a surface. Quit quietly. 
         break; 
        } 
        sGLThreadManager.checkGLDriver(gl); 
        createEglSurface = false; 
       } 

रहे हैं:

   if (createEglSurface) { 
        if (LOG_SURFACE) { 
         Log.w("GLThread", "egl createSurface"); 
        } 
        gl = (GL10) mEglHelper.createSurface(getHolder()); 
        if (gl == null) { 
         // If we escape, GLThread ends up. Don't escape. 
         continue; 
        } 
        sGLThreadManager.checkGLDriver(gl); 
        createEglSurface = false; 
       } 

यह मेरे लिए लग रहा है इस समस्या की तरह fixed in JellyBean था।

+0

अच्छी पकड़, धन्यवाद! एक लाइन को पैच करने के किसी भी आसान तरीके की कमी के कारण, मैंने जेली बीन से पूरी कक्षा का समर्थन किया। – usethe4ce

+0

@ usethe4ce, धन्यवाद। सौभाग्य। – Dalinaum

+1

आप उस पंक्ति को कैसे पकड़ सकते हैं? मुझे एक ही समस्या है। क्या आप कृपया मुझे कुछ संकेत दे सकते हैं। आपका बहुत बहुत धन्यवाद। – AmyWuGo

1

मुझे एक ही समस्या थी और सतह के लिए कॉलबैक सेट करके इसे ठीक किया गया और super.surfaceDestroyed को कॉल किया गया।

glSurfaceView = new GLSurfaceView(context) { 
    public void surfaceDestroyed(SurfaceHolder holder) { 
     super.surfaceDestroyed(holder); 
    } 
}; 
+0

मेरी समस्या एक ही मामला नहीं था। मेरा जवाब भी देखें। वैसे भी, @codeNinja धन्यवाद। – Dalinaum

संबंधित मुद्दे