Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map: Fix unsafe reference to unique_ptr #1897

Merged
merged 1 commit into from
Mar 10, 2021
Merged

Map: Fix unsafe reference to unique_ptr #1897

merged 1 commit into from
Mar 10, 2021

Conversation

dg0yt
Copy link
Member

@dg0yt dg0yt commented Mar 10, 2021

The scheduled template loading event is bound to the lifetime of the
template object, but the lambda captures a reference to the unique_ptr
owning the template. The lifetime of the unique_ptr can end before the
lifetime of the pointed-to object when ownership is transferred to
another unique_ptr. Here, this is triggered when the the template
container reallocates memory due to insertion.
We can safely capture a raw pointer to the template instead.
Fixes GH-1893 (crash on early location display toggle).

The scheduled template loading event is bound to the lifetime of the
template object, but the lambda captures a reference to the unique_ptr
owning the template. The lifetime of the unique_ptr can end before the
lifetime of the pointed-to object when ownership is transferred to
another unique_ptr. Here, this is triggered when the the template
container reallocates memory due to insertion.
We can safely capture a raw pointer to the template instead.
Fixes GH-1893 (crash on early location display toggle).
@dg0yt dg0yt merged commit d04e48d into master Mar 10, 2021
@dg0yt dg0yt deleted the issue-1893 branch March 10, 2021 08:01
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.

Crash on Location display toggle during template load
1 participant