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

Commit a335541c authored by Weiming Zhao's avatar Weiming Zhao Committed by Giulio Cervera
Browse files

libRS: Correct the screen freezing issue

This fixes a timing issue where it could calculate a delay of 0
(indicating wait forever) when it has no pending commands to actually
execute. In such cases, it should just break out of the playback loop.
This also fixes a small issue with returning whether or not to redraw.
(Provided by Stephen Hines <srhines@google.com>)

CRs-Fixed: 330352

Change-Id: If3c880e1546105279d286ae76cc41e8b8f193ec1
parent 481e26b2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -124,7 +124,6 @@ bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand, uint64_t time
    while (!mToCore.isEmpty() || waitForCommand) {
        uint32_t cmdID = 0;
        uint32_t cmdSize = 0;
        ret = true;
        if (con->props.mLogTimes) {
            con->timerSet(Context::RS_TIMER_IDLE);
        }
@@ -136,11 +135,17 @@ bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand, uint64_t time
                delay = 0;
            }
        }

        if (delay == 0 && timeToWait != 0 && mToCore.isEmpty()) {
            break;
        }

        const void * data = mToCore.get(&cmdID, &cmdSize, delay);
        if (!cmdSize) {
            // exception or timeout occurred.
            return false;
            break;
        }
        ret = true;
        if (con->props.mLogTimes) {
            con->timerSet(Context::RS_TIMER_INTERNAL);
        }