Fix BufferHubBufferTest test crash
Fix: 124377165
Test: BufferHub_test
verified on vega_xr target on oc-dr1-daydream-dev branch.
I cannot reproduce the test failure on master branch locally, although
it exist on the builds on Blackbox dashboard. Anyhow, I am certain about
this fix.
Change-Id: Ic473aae794b2996da1e713cd02a2bfc31cbaab1b
diff --git a/libs/ui/tests/BufferHubBuffer_test.cpp b/libs/ui/tests/BufferHubBuffer_test.cpp
index 634bce1..efc1a80 100644
--- a/libs/ui/tests/BufferHubBuffer_test.cpp
+++ b/libs/ui/tests/BufferHubBuffer_test.cpp
@@ -214,8 +214,8 @@
native_handle_t* token = native_handle_create(/*numFds=*/0, /*numInts=*/1);
token->data[0] = 0;
- auto b1 = BufferHubBuffer::import(NativeHandle::create(token, /*ownHandle=*/true));
- native_handle_delete(token);
+ sp<NativeHandle> tokenHandle = NativeHandle::create(token, /*ownHandle=*/true);
+ auto b1 = BufferHubBuffer::import(tokenHandle);
EXPECT_THAT(b1, IsNull());
}