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

Commit 5a65e300 authored by Andreas Huber's avatar Andreas Huber
Browse files

Make sure all references to the decoder plugin are accounted for

before calling dlunload().

Change-Id: I59aa1d19edf566b8a86a6f73b1c2eeb47c96b0de
related-to-bug: 4466387
parent f2af5a2c
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);