This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
impeller/renderer/backend/metal Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -43,10 +43,10 @@ class SurfaceMTL final : public Surface {
43
43
id<MTLDrawable> drawable () const { return drawable_; }
44
44
45
45
private:
46
- std::weak_ptr <Context> context_;
46
+ std::shared_ptr <Context> context_;
47
47
id<MTLDrawable> drawable_ = nil;
48
48
49
- SurfaceMTL (const std::weak_ptr <Context>& context,
49
+ SurfaceMTL (const std::shared_ptr <Context>& context,
50
50
const RenderTarget& target,
51
51
id<MTLDrawable> drawable);
52
52
Original file line number Diff line number Diff line change 112
112
render_target_desc.SetStencilAttachment (stencil0);
113
113
114
114
// The constructor is private. So make_unique may not be used.
115
- return std::unique_ptr<SurfaceMTL>(new SurfaceMTL (
116
- context-> weak_from_this () , render_target_desc, current_drawable));
115
+ return std::unique_ptr<SurfaceMTL>(
116
+ new SurfaceMTL (context , render_target_desc, current_drawable));
117
117
}
118
118
119
- SurfaceMTL::SurfaceMTL (const std::weak_ptr <Context>& context,
119
+ SurfaceMTL::SurfaceMTL (const std::shared_ptr <Context>& context,
120
120
const RenderTarget& target,
121
121
id <MTLDrawable > drawable)
122
122
: Surface(target), context_(context), drawable_(drawable) {}
131
131
}
132
132
133
133
id <MTLCommandBuffer > command_buffer =
134
- ContextMTL::Cast (context_.lock (). get ())->CreateMTLCommandBuffer ();
134
+ ContextMTL::Cast (context_.get ())->CreateMTLCommandBuffer ();
135
135
[command_buffer presentDrawable: drawable_];
136
136
[command_buffer commit ];
137
137
You can’t perform that action at this time.
0 commit comments