Fix Mac desktop platform for use with std::weak_ptr in the PlatformView. (flutter/engine#3897)

This commit is contained in:
Chinmay Garde 2017-07-18 14:29:36 -07:00 committed by GitHub
parent 1a126078de
commit 9dbdc4bee6

View File

@ -37,7 +37,7 @@ static inline blink::PointerData::Change PointerChangeFromNSEventPhase(NSEventPh
}
@implementation FlutterWindow {
std::unique_ptr<shell::PlatformViewMac> _platformView;
std::shared_ptr<shell::PlatformViewMac> _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<shell::PlatformViewMac>(self.renderSurface);
_platformView->Attach();
_platformView->SetupResourceContextOnIOThread();
_platformView->NotifyCreated(std::make_unique<shell::GPUSurfaceGL>(_platformView.get()));