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

GlideImagesPlugin bug #259

Closed
achenglike opened this issue Jun 8, 2020 · 3 comments
Closed

GlideImagesPlugin bug #259

achenglike opened this issue Jun 8, 2020 · 3 comments
Labels

Comments

@achenglike
Copy link

  • Markwon version: 4.4.0

The markwon-image-glide module -> GlideImagesPlugin.java -> public static GlideImagesPlugin create(@nonnull final Context context) : this method use context to create new RequestManager when called method (public void cancel(@nonnull Target<?> target)) case by OnAttachStateChangeListener(in AsyncDrawableScheduler.java) called onViewDetachedFromWindow -> unschedule(@nonnull TextView view).

In this condation maybe the Activity allready destroied before public void cancel(@nonnull Target<?> target) called, and glide will throw exception "You cannot start a load for a destroyed activity"

@noties
Copy link
Owner

noties commented Jun 8, 2020

Hello @achenglike ,

is this a confirmed crash or you are just anticipating one?

@achenglike
Copy link
Author

Hello @achenglike ,

is this a confirmed crash or you are just anticipating one?

Yes, a confirmed crash. AppCompatActivity->Fragment->RecycleView->TextView(use Markwon).Accidental appearance. I just change:

    @NonNull
    public static GlideImagesPlugin create(@NonNull final Context context) {
        return create(new GlideImagesPlugin.GlideStore() {
            @NonNull
            @Override
            public RequestBuilder<Drawable> load(@NonNull AsyncDrawable drawable) {
                return Glide.with(context)
                        .load(drawable.getDestination());
            }

            @Override
            public void cancel(@NonNull Target<?> target) {
                Glide.with(context)
                        .clear(target);
            }
        });
    }

to

    @NonNull
    public static GlideImagesPlugin create(@NonNull final Context context) {
        return create(Glide.with(context));
    }

@noties
Copy link
Owner

noties commented Jun 9, 2020

It seems that calling Glide.with(context) in cancel method would cause crash here. Meanwhile reusing the instance of Glide.with(context) would not

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