From 9dbdc4bee6818536eaeea7f7e285922d2ae2cae7 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 18 Jul 2017 14:29:36 -0700 Subject: [PATCH] Fix Mac desktop platform for use with std::weak_ptr in the PlatformView. (flutter/engine#3897) --- .../flutter/shell/platform/darwin/desktop/flutter_window.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/desktop/flutter_window.mm b/engine/src/flutter/shell/platform/darwin/desktop/flutter_window.mm index 683bf4a3668..912a32ff6e2 100644 --- a/engine/src/flutter/shell/platform/darwin/desktop/flutter_window.mm +++ b/engine/src/flutter/shell/platform/darwin/desktop/flutter_window.mm @@ -37,7 +37,7 @@ static inline blink::PointerData::Change PointerChangeFromNSEventPhase(NSEventPh } @implementation FlutterWindow { - std::unique_ptr _platformView; + std::shared_ptr _platformView; bool _mouseIsDown; } @@ -55,7 +55,7 @@ static inline blink::PointerData::Change PointerChangeFromNSEventPhase(NSEventPh - (void)setupPlatformView { FTL_DCHECK(_platformView == nullptr) << "The platform view must not already be set."; - _platformView.reset(new shell::PlatformViewMac(self.renderSurface)); + _platformView = std::make_shared(self.renderSurface); _platformView->Attach(); _platformView->SetupResourceContextOnIOThread(); _platformView->NotifyCreated(std::make_unique(_platformView.get()));