Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50db92c4 authored by Wei-Ta Chen's avatar Wei-Ta Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix 3122139, where previewing an attachment for the second time will fail."

parents dca9cd6d 58c1579c
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ static SkMemoryStream* buildSkMemoryStream(SkStream *stream) {
        }
    }
    data = (char*)sk_realloc_throw(data, streamLen);

    SkMemoryStream* streamMem = new SkMemoryStream();
    streamMem->setMemoryOwned(data, streamLen);
    return streamMem;
@@ -133,6 +134,12 @@ static jobject nativeNewInstanceFromFileDescriptor(JNIEnv* env, jobject clazz,
        }
        stream = fdStream;
    } else {
        /* Restore our offset when we leave, so we can be called more than once
           with the same descriptor. This is only required if we didn't dup the
           file descriptor, but it is OK to do it all the time.
        */
        AutoFDSeek as(descriptor);

        SkFDStream* fdStream = new SkFDStream(descriptor, false);
        if (!fdStream->isValid()) {
            fdStream->unref();
@@ -142,12 +149,6 @@ static jobject nativeNewInstanceFromFileDescriptor(JNIEnv* env, jobject clazz,
        fdStream->unref();
    }

    /* Restore our offset when we leave, so we can be called more than once
       with the same descriptor. This is only required if we didn't dup the
       file descriptor, but it is OK to do it all the time.
    */
    AutoFDSeek as(descriptor);

    return doBuildTileIndex(env, stream);
}