Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix holes in IObservableVector<IInspectable>#544

Merged
kennykerr merged 2 commits intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
oldnewthing:indexof-wrapperCopy head branch name to clipboard
Feb 29, 2020
Merged

Fix holes in IObservableVector<IInspectable>#544
kennykerr merged 2 commits intomicrosoft:mastermicrosoft/cppwinrt:masterfrom
oldnewthing:indexof-wrapperCopy head branch name to clipboard

Conversation

@oldnewthing
Copy link
Member

ReplaceAll did not provide the strong exception guarantee: If not all the elements could be converted to T, the code left the vector in a partially-replaced state. Now it leaves the vector unchanged if the operation fails. (Note that vector_base::assign does not provide the strong exception guarantee if wrapping is required, so we can't quite declare victory yet.)

If the underlying vector is a vector of value types, then attempting to insert nullptr now fails with E_NOINTERFACE rather than crashing.

If the object's runtime type is not T, then IndexOf should report "not found" rather than reporting the index of the first nullptr (if T is a reference type) or crashing (if T is a value type). This fixes issue #518.

Fixed use-after-free bug in test, where we forgot to unregister event handlers, leaving them with references to destroyed local variables.

* ReplaceAll did not provide the strong exception guarantee:
  If not all the elements could be converted to T,
  the code left the vector in a partially-replaced state.
  Now it leaves the vector unchanged if the operation fails.
  (Note that vector_base::assign does not provide the strong
  exception guarantee if wrapping is required, so we can't
  quite declare victory yet.)

* If the underlying vector is a vector of value types,
  then attempting to insert nullptr now fails with E_NOINTERFACE
  rather than crashing.

* If the object's runtime type is not T, then IndexOf should report
  "not found" rather than reporting the index of the first nullptr
  (if T is a reference type) or crashing (if T is a value type).
strings/base_collections_vector.h Outdated Show resolved Hide resolved
Throws an exception rather than crashing.
@kennykerr
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.