Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions strings/base_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,11 @@ WINRT_EXPORT namespace winrt
std::memset(&result, 0, sizeof(result));
result.first = this->size();
result.second = *reinterpret_cast<impl::arg_out<T>*>(this);
std::memset(this, 0, sizeof(com_array<T>));
#else
std::pair<std::uint32_t, impl::arg_out<T>> result(this->size(), *reinterpret_cast<impl::arg_out<T>*>(this));
#endif
this->m_data = nullptr;
this->m_size = 0;
#endif
return result;
}

Expand Down
13 changes: 13 additions & 0 deletions test/old_tests/UnitTests/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,19 @@ TEST_CASE("com_array,move")
REQUIRE(b.empty());
}

TEST_CASE("com_array,detach")
{
com_array<int> a{ 1, 2, 3 };
auto detached = detach_abi(a);
com_array<int> b(detached.second, detached.first, take_ownership_from_abi);

REQUIRE(a.empty());
REQUIRE(3 == b.size());
REQUIRE(b[0] == 1);
REQUIRE(b[1] == 2);
REQUIRE(b[2] == 3);
}

//
// Now some tests covering producing and consuming arrays
//
Expand Down
Loading