Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[cp][core] Fix GeoJSONVTData ownership and life cycle #16108

Merged
merged 1 commit into from
Jan 9, 2020

Conversation

pozdnyakov
Copy link
Contributor

CP #16106 to release-tequila

Before this change, the `GeoJSONVTData` instance was retained at the scheduled
lambda, which run on the worker thread represented by the `GeoJSONVTData::scheduler`
class member:

```
        std::weak_ptr<GeoJSONVTData> weak = shared_from_this();
        scheduler->scheduleAndReplyValue(
            [id, weak, this]() -> TileFeatures {
                if (auto self = weak.lock()) {
                    return impl.getTile(id.z, id.x, id.y).features;
                }
                return {};
            },
            fn);
```

It caused program termination in case `self` turned to be the last reference to `this`,
as the `std::thread` destructor was called from the thread it represented.

Now, only the `GeoJSONVTData::impl` class member is retained.
@pozdnyakov pozdnyakov added the 🍒 cherry pick Indicates that a PR is a cherry pick. label Jan 9, 2020
@pozdnyakov pozdnyakov merged commit 839deb0 into release-tequila Jan 9, 2020
@pozdnyakov pozdnyakov deleted the cp_16106_release_tequila branch January 9, 2020 15:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🍒 cherry pick Indicates that a PR is a cherry pick.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants