Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using GifTextureView in ListView #240

Closed
huyduongtu opened this issue Jan 7, 2016 · 6 comments
Closed

Crash when using GifTextureView in ListView #240

huyduongtu opened this issue Jan 7, 2016 · 6 comments
Labels

Comments

@huyduongtu
Copy link

I'm using GifTextureView in ListView item.
The code segment in Adapter is following:

@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.texture_item, parent, false);
            holder = new ViewHolder();
            holder.imageView = (GifTextureView) convertView.findViewById(R.id.gif);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.imageView.setInputSource(new InputSource.FileSource(imgSources[position]));

        return convertView;
    }

    public static class ViewHolder {
        GifTextureView imageView;
    }

When I press back away off this activity. It crashes or show dialog ANR.

01-07 14:17:55.495 13166-13365/huy.com.gifresearch E/AndroidRuntime: FATAL EXCEPTION: GifRenderThread
Process: huy.com.gifresearch, PID: 13166
java.lang.RuntimeException: Display loop poll failed Interrupted system call
    at huy.com.libgifdrawable.GifInfoHandle.bindSurface(Native Method)
    at huy.com.libgifdrawable.GifInfoHandle.bindSurface(GifInfoHandle.java:134)
    at huy.com.libgifdrawable.GifTextureView$RenderThread.run(GifTextureView.java:218)
@koral-- koral-- added the bug label Jan 7, 2016
@koral--
Copy link
Owner

koral-- commented Jan 7, 2016

That exception occurs because process has been interrupted by clicking OK/Force Close button in crash/ANR dialog. That another crash/ANR is not necessarily caused by this library.
Basically waiting for the moment of frame rendering is interrupted because app process is being killed.
Only thing I can do is to ignore interruption and exit from rendering loop gracefully. You need to find a reason of ANR/another uncaught exception.

@huyduongtu
Copy link
Author

I don't know why. My listview's item is GifTextureView. When I press Back to exit the activity. It always crashes or shows ANR dialog.
What should I do to avoid this?

@koral--
Copy link
Owner

koral-- commented Jan 7, 2016

Could you post complete logcat?

@koral--
Copy link
Owner

koral-- commented Jan 7, 2016

OK, I was able to reproduce ANR. I'll fix it ASAP.

@huyduongtu
Copy link
Author

This is all in my adapter.

public class GifTextureViewAdapter extends BaseAdapter {
    private Context mContext;
    private String[] imgSources;

    public GifTextureViewAdapter(Context context) {
        mContext = context;
        imgSources = Images.getImgSources();
    }

    @Override
    public int getCount() {
        return imgSources.length;
    }

    @Override
    public Object getItem(int position) {
        return imgSources[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.texture_item, parent, false);
            holder = new ViewHolder();
            holder.imageView = (GifTextureView) convertView.findViewById(R.id.gif);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.imageView.setInputSource(new InputSource.FileSource(imgSources[position]));

        return convertView;
    }

    public static class ViewHolder {
        GifTextureView imageView;
    }
}

The log crash is:

FATAL EXCEPTION: GifRenderThread
Process: huy.com.gifresearch, PID: 17708
java.lang.RuntimeException: Display loop poll failed Interrupted system call
        at huy.com.libgifdrawable.GifInfoHandle.bindSurface(Native Method)
        at huy.com.libgifdrawable.GifInfoHandle.bindSurface(GifInfoHandle.java:134)
        at huy.com.libgifdrawable.GifTextureView$RenderThread.run(GifTextureView.java:218)

It always crashes or show ARN dialog

@koral--
Copy link
Owner

koral-- commented Jan 8, 2016

Fixed in 1.1.12-SNAPSHOT.

@koral-- koral-- closed this as completed Jan 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants