diff options
author | 2018-03-27 13:29:13 -0700 | |
---|---|---|
committer | 2018-03-27 13:29:13 -0700 | |
commit | fe924f35e25d1fc583be979ed7799cb922dd6675 (patch) | |
tree | 1250983cea117b895742484e69040925b41d1ec2 | |
parent | ccd348460ca25890a8fb709e82e6f780e3ce878e (diff) |
Fix broken BufferHubQueueTest.TestRemoveBuffer
Under certain condition, it's unsafe to nullify the consumer channel
within producer channel's destructor.
Bug: 38137191
Bug: 70046255
Bug: 70912269
Test: buffer_hub-test, buffer_hub_queue-tests, buffer_hub_queue_producer-tesst
Change-Id: Ifbed85e687e71340f6876e4e85c792ae1d6b06f6
-rw-r--r-- | libs/vr/libbufferhub/buffer_hub-test.cpp | 7 | ||||
-rw-r--r-- | services/vr/bufferhubd/producer_channel.cpp | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/libs/vr/libbufferhub/buffer_hub-test.cpp b/libs/vr/libbufferhub/buffer_hub-test.cpp index 3ce5c9f8d6..660a2003ea 100644 --- a/libs/vr/libbufferhub/buffer_hub-test.cpp +++ b/libs/vr/libbufferhub/buffer_hub-test.cpp @@ -769,9 +769,14 @@ TEST_F(LibBufferHubTest, TestDetachBufferFromProducer) { auto s3 = p->CreateConsumer(); EXPECT_FALSE(s3); + // Note that here the expected error code is EOPNOTSUPP as the socket towards + // ProducerChannel has been teared down. EXPECT_EQ(s3.error(), EOPNOTSUPP); s3 = c->CreateConsumer(); EXPECT_FALSE(s3); - EXPECT_EQ(s3.error(), EOPNOTSUPP); + // Note that here the expected error code is EPIPE returned from + // ConsumerChannel::HandleMessage as the socket is still open but the producer + // is gone. + EXPECT_EQ(s3.error(), EPIPE); } diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp index e141b91286..c38c12b7b1 100644 --- a/services/vr/bufferhubd/producer_channel.cpp +++ b/services/vr/bufferhubd/producer_channel.cpp @@ -134,7 +134,6 @@ ProducerChannel::~ProducerChannel() { channel_id(), buffer_id(), buffer_state_->load()); for (auto consumer : consumer_channels_) { consumer->OnProducerClosed(); - service()->SetChannel(consumer->channel_id(), nullptr); } Hangup(); } |