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

Commit c54e9e88 authored by Kobi Cohen Arazi's avatar Kobi Cohen Arazi Committed by Steve Kondik
Browse files

Add lock before calling initEglImage

Without that lock, there is a chance of race condition
where while composing a specific index, requestBuf with
the same index can be executed and touch the
same data that is being used in initEglImage.
(e.g. dirty flag in texture)
parent 8cfcc04a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -889,8 +889,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy,
    ssize_t index = mActiveBuffer;
    if (index >= 0) {
        if (!mFailover) {
            {
               // Without that lock, there is a chance of race condition
               // where while composing a specific index, requestBuf
               // with the same index can be executed and touch the same data
               // that is being used in initEglImage.
               // (e.g. dirty flag in texture)
               Mutex::Autolock _l(mLock);
               Image& texture(mBufferData[index].texture);
               err = mTextureManager.initEglImage(&texture, dpy, buffer);
            }
            // if EGLImage fails, we switch to regular texture mode, and we
            // free all resources associated with using EGLImages.
            if (err == NO_ERROR) {