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

Commit 6bd09198 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder_ndk unit tests: hold onto linked binder

It's now required to hold onto a binder if you are linked to death to
it, so that there is no memory leak when someone forgets to unlink. This
is consistent with the libbinder_ndk documentation.

Bug: 145692765
Test: ./runtests.sh
Change-Id: Id7622301ed2691ae2e4bfa472a332e3823e70003
parent 8e7d61c0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -87,14 +87,14 @@ TEST(NdkBinder, DeathRecipient) {
    EXPECT_EQ(STATUS_DEAD_OBJECT, foo->die());

    foo = nullptr;
    AIBinder_decStrong(binder);
    binder = nullptr;

    std::unique_lock<std::mutex> lock(deathMutex);
    EXPECT_TRUE(deathCv.wait_for(lock, 1s, [&] { return deathRecieved; }));
    EXPECT_TRUE(deathRecieved);

    AIBinder_DeathRecipient_delete(recipient);
    AIBinder_decStrong(binder);
    binder = nullptr;
}

TEST(NdkBinder, RetrieveNonNdkService) {