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

Commit ce81f1ff authored by Presubmit Automerger Backend's avatar Presubmit Automerger Backend
Browse files

[automerge] RESTRICT AUTOMERGE SurfaceFlinger: fix a potential race condition...

[automerge] RESTRICT AUTOMERGE SurfaceFlinger: fix a potential race condition in stealReceiveChannel 2p: 29e34cfc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/18766107

Bug: 232541124
Change-Id: Iac86443781ff38b899f95ed5b3777325fb8a962f
parents fa57bb81 29e34cfc
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -171,6 +171,11 @@ void EventThreadConnection::onFirstRef() {
}

status_t EventThreadConnection::stealReceiveChannel(gui::BitTube* outChannel) {
    std::scoped_lock lock(mLock);
    if (mChannel.initCheck() != NO_ERROR) {
        return NAME_NOT_FOUND;
    }

    outChannel->setReceiveFd(mChannel.moveReceiveFd());
    outChannel->setSendFd(base::unique_fd(dup(mChannel.getSendFd())));
    return NO_ERROR;
+2 −1
Original line number Diff line number Diff line
@@ -102,7 +102,8 @@ public:
private:
    virtual void onFirstRef();
    EventThread* const mEventThread;
    gui::BitTube mChannel;
    std::mutex mLock;
    gui::BitTube mChannel GUARDED_BY(mLock);

    std::vector<DisplayEventReceiver::Event> mPendingEvents;
};