FATAL SIGNAL 11 (Sigsegv) at 0x00000000 (code=1)?

前端 未结 6 1110
余生分开走
余生分开走 2021-02-04 06:49

Why does this problem occur?

public static String path;
private VideoView mVideoView;


mVideoView = (VideoView) findViewById(R.id.surface_view);
mVideoView.setV         


        
6条回答
  •  不知归路
    2021-02-04 07:35

    I had a similar problem when finishing my activity with two TextureViews (i.e. pressing the home button):

    Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa4680000 in tid 29013 (pool-4-thread-1)
    

    The logcat showed that the segv showed up inside a drawXXX function. So I tried to not draw when the surface is destroyed:

    private synchronized void doDraw(Canvas canvas) {
    ...
    }
    

    doDraw() is called regularly by a background thread. To be precise, using a ScheduledExecutorService. This thingy is stopped in the destroyed listener, which also got the synchronized keyword:

    public synchronized boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
        executorService.shutdownNow();
        return true;
    }
    

    This guarantees that the surface can only be destroyed when currently nothing is drawn.

    No more crashes on leaving the activity now!

    It seems to me that nobody is using TextureViews but still SurfaceViews. Unfortunately, the latter has some problems when drawing translucent graphics on some devices, that's why I switched to TextureView.

    Hope this helps.

提交回复
热议问题