package kotlinx.coroutines;

/* JADX INFO: compiled from: CoroutineContext.kt */
/* JADX INFO: loaded from: classes.dex */
public final class l2<T> extends kotlinx.coroutines.o2.o<T> {

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private h.u.g f1092g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private Object f1093h;

    @Override // kotlinx.coroutines.o2.o, kotlinx.coroutines.c
    protected void D0(Object obj) {
        h.u.g gVar = this.f1092g;
        if (gVar != null) {
            kotlinx.coroutines.o2.u.a(gVar, this.f1093h);
            this.f1092g = null;
            this.f1093h = null;
        }
        Object objA = f0.a(obj, this.f1119f);
        h.u.d<T> dVar = this.f1119f;
        h.u.g context = dVar.getContext();
        Object objC = kotlinx.coroutines.o2.u.c(context, null);
        l2<?> l2VarE = objC != kotlinx.coroutines.o2.u.a ? h0.e(dVar, context, objC) : null;
        try {
            this.f1119f.g(objA);
            h.r rVar = h.r.a;
        } finally {
            if (l2VarE == null || l2VarE.H0()) {
                kotlinx.coroutines.o2.u.a(context, objC);
            }
        }
    }

    public final boolean H0() {
        if (this.f1092g == null) {
            return false;
        }
        this.f1092g = null;
        this.f1093h = null;
        return true;
    }

    public final void I0(h.u.g gVar, Object obj) {
        this.f1092g = gVar;
        this.f1093h = obj;
    }
}
