diff options
Diffstat (limited to 'src/mbgl/style/layers/custom_layer.cpp')
-rw-r--r-- | src/mbgl/style/layers/custom_layer.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mbgl/style/layers/custom_layer.cpp b/src/mbgl/style/layers/custom_layer.cpp index 854c771847..40013f3422 100644 --- a/src/mbgl/style/layers/custom_layer.cpp +++ b/src/mbgl/style/layers/custom_layer.cpp @@ -10,19 +10,27 @@ CustomLayer::CustomLayer(const std::string& layerID, CustomLayerRenderFunction render, CustomLayerContextLostFunction contextLost, CustomLayerDeinitializeFunction deinit, + CustomLayerDeallocationFunction deallocation, void* context) - : Layer(makeMutable<Impl>(layerID, init, render, contextLost, deinit, context)) { + : Layer(makeMutable<Impl>(layerID, init, render, contextLost, deinit, context)), + deallocationFn(deallocation) { } CustomLayer::CustomLayer(const std::string& layerID, CustomLayerInitializeFunction init, CustomLayerRenderFunction render, CustomLayerDeinitializeFunction deinit, + CustomLayerDeallocationFunction deallocation, void* context) - : Layer(makeMutable<Impl>(layerID, init, render, nullptr, deinit, context)) { + : Layer(makeMutable<Impl>(layerID, init, render, nullptr, deinit, context)), + deallocationFn(deallocation) { } -CustomLayer::~CustomLayer() = default; +CustomLayer::~CustomLayer() { + if (deallocationFn) { + deallocationFn(&peer); + } +}; const CustomLayer::Impl& CustomLayer::impl() const { return static_cast<const Impl&>(*baseImpl); |