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

Commit aaa8951a authored by Wei Wang's avatar Wei Wang Committed by Automerger Merge Worker
Browse files

Merge "Fix possible leaks in CanvasContext HintSessionWrapper" into udc-qpr-dev am: dc2ea290

parents b74be890 dc2ea290
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ void CanvasContext::destroy() {
    destroyHardwareResources();
    mAnimationContext->destroy();
    mRenderThread.cacheManager().onContextStopped(this);
    mHintSessionWrapper.destroy();
}

static void setBufferCount(ANativeWindow* window) {
@@ -193,6 +194,7 @@ void CanvasContext::setHardwareBuffer(AHardwareBuffer* buffer) {
void CanvasContext::setSurface(ANativeWindow* window, bool enableTimeout) {
    ATRACE_CALL();

    startHintSession();
    if (window) {
        mNativeSurface = std::make_unique<ReliableSurface>(window);
        mNativeSurface->init();
+9 −0
Original line number Diff line number Diff line
@@ -93,8 +93,17 @@ HintSessionWrapper::HintSessionWrapper(pid_t uiThreadId, pid_t renderThreadId)
        : mUiThreadId(uiThreadId), mRenderThreadId(renderThreadId) {}

HintSessionWrapper::~HintSessionWrapper() {
    destroy();
}

void HintSessionWrapper::destroy() {
    if (mHintSessionFuture.valid()) {
        mHintSession = mHintSessionFuture.get();
    }
    if (mHintSession) {
        gAPH_closeSessionFn(mHintSession);
        mSessionValid = true;
        mHintSession = nullptr;
    }
}

+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public:
    void sendLoadResetHint();
    void sendLoadIncreaseHint();
    bool init();
    void destroy();

private:
    APerformanceHintSession* mHintSession = nullptr;