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

Commit 931db87f authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Make sure all references to the decoder plugin are accounted for"

parents 90d99759 5a65e300
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ struct SimpleSoftOMXComponent : public SoftOMXComponent {
            OMX_PTR appData,
            OMX_COMPONENTTYPE **component);

    virtual ~SimpleSoftOMXComponent();
    virtual void prepareForDestruction();

    void onMessageReceived(const sp<AMessage> &msg);

+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ struct SoftOMXComponent : public RefBase {
    void setLibHandle(void *libHandle);
    void *libHandle() const;

    virtual void prepareForDestruction() {}

protected:
    virtual ~SoftOMXComponent();

+5 −1
Original line number Diff line number Diff line
@@ -45,7 +45,11 @@ SimpleSoftOMXComponent::SimpleSoftOMXComponent(
            PRIORITY_AUDIO);
}

SimpleSoftOMXComponent::~SimpleSoftOMXComponent() {
void SimpleSoftOMXComponent::prepareForDestruction() {
    // The looper's queue may still contain messages referencing this
    // object. Make sure those are flushed before returning so that
    // a subsequent dlunload() does not pull out the rug from under us.

    mLooper->unregisterHandler(mHandler->id());
    mLooper->stop();
}
+2 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ OMX_ERRORTYPE SoftOMXPlugin::destroyComponentInstance(
        (SoftOMXComponent *)
            ((OMX_COMPONENTTYPE *)component)->pComponentPrivate;

    me->prepareForDestruction();

    void *libHandle = me->libHandle();

    CHECK_EQ(me->getStrongCount(), 1);