OSDN Git Service

Make sure the message dispatcher stays around until after OMX_FreeHandle is finished...
authorAndreas Huber <andih@google.com>
Fri, 17 Sep 2010 18:49:39 +0000 (11:49 -0700)
committerAndreas Huber <andih@google.com>
Fri, 17 Sep 2010 18:49:39 +0000 (11:49 -0700)
Change-Id: I9c896cf07dea0c3201b6f074dbaf27e6d85cd784

media/libstagefright/OMXCodec.cpp
media/libstagefright/omx/OMX.cpp

index b6710af..523b79c 100644 (file)
@@ -1443,6 +1443,8 @@ void OMXCodec::setComponentRole() {
 }
 
 OMXCodec::~OMXCodec() {
+    mSource.clear();
+
     CHECK(mState == LOADED || mState == ERROR);
 
     status_t err = mOMX->freeNode(mNode);
index 6de761f..c927da1 100644 (file)
@@ -245,13 +245,15 @@ status_t OMX::freeNode(node_id node) {
     CHECK(index >= 0);
     mLiveNodes.removeItemsAt(index);
 
+    instance->observer()->asBinder()->unlinkToDeath(this);
+
+    status_t err = instance->freeNode(mMaster);
+
     index = mDispatchers.indexOfKey(node);
     CHECK(index >= 0);
     mDispatchers.removeItemsAt(index);
 
-    instance->observer()->asBinder()->unlinkToDeath(this);
-
-    return instance->freeNode(mMaster);
+    return err;
 }
 
 status_t OMX::sendCommand(