fix: make render orchestrator teardown safe
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
This commit is contained in:
@@ -191,9 +191,21 @@ RenderOrchestrator::~RenderOrchestrator() {
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for any deferred cleanup tasks to complete before releasing and potentially
|
||||
// destroying the scheduler. Those cleanup tasks must not hold the final reference
|
||||
// to the scheduler because it cannot be destroyed from one of its own pool threads.
|
||||
// Finish work that can still reach the source observers before detaching them.
|
||||
threadPool.waitForEmpty();
|
||||
|
||||
for (auto& entry : renderSources) {
|
||||
entry.second->setObserver(nullptr);
|
||||
}
|
||||
glyphManager->setObserver(nullptr);
|
||||
imageManager->setObserver(nullptr);
|
||||
|
||||
// Tile destructors can synchronously report Cancelled and enqueue further work.
|
||||
// Destroy sources while the readiness state and its mutex are still alive.
|
||||
renderSources.clear();
|
||||
|
||||
// Drain work submitted by source/tile destruction before the scheduler and
|
||||
// the remaining orchestrator state are torn down.
|
||||
threadPool.waitForEmpty();
|
||||
}
|
||||
|
||||
|
||||
@@ -311,6 +311,9 @@ public:
|
||||
const ZoomHistory& getZoomHistory() const { return zoomHistory; }
|
||||
|
||||
private:
|
||||
// Allows the focused teardown test to install a pending tile-backed source.
|
||||
friend struct RenderOrchestratorTeardownTestAccess;
|
||||
|
||||
bool isLoaded() const;
|
||||
bool hasTransitions(TimePoint) const;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ RenderSource::RenderSource(Immutable<style::Source::Impl> impl)
|
||||
RenderSource::~RenderSource() = default;
|
||||
|
||||
void RenderSource::setObserver(RenderSourceObserver* observer_) {
|
||||
observer = observer_;
|
||||
observer = observer_ ? observer_ : &nullObserver;
|
||||
}
|
||||
|
||||
void RenderSource::onTileChanged(Tile& tile) {
|
||||
|
||||
Reference in New Issue
Block a user