Use base::weak_qptr / base::make_weak.
This commit is contained in:
@@ -157,12 +157,12 @@ void LayerWidget::checkCacheBackground() {
|
||||
|
||||
void LayerWidget::cacheBackground() {
|
||||
_backgroundCaching = true;
|
||||
const auto weak = Ui::MakeWeak(this);
|
||||
const auto weak = base::make_weak(this);
|
||||
const auto night = IsNightMode();
|
||||
crl::async([weak, night, image = renderBackground()]() mutable {
|
||||
auto result = ProcessBackground(image, night);
|
||||
crl::on_main([weak, night, result = std::move(result)]() mutable {
|
||||
if (const auto strong = weak.data()) {
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->backgroundReady(std::move(result), night);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -228,12 +228,12 @@ void InitEditorLayer(
|
||||
layer->closeLayer();
|
||||
}, editor->lifetime());
|
||||
|
||||
const auto weak = Ui::MakeWeak(layer.get());
|
||||
const auto weak = base::make_weak(layer.get());
|
||||
editor->doneRequests(
|
||||
) | rpl::start_with_next([=, done = std::move(doneCallback)](
|
||||
const PhotoModifications &mods) {
|
||||
done(mods);
|
||||
if (const auto strong = weak.data()) {
|
||||
if (const auto strong = weak.get()) {
|
||||
strong->closeLayer();
|
||||
}
|
||||
}, editor->lifetime());
|
||||
|
||||
Reference in New Issue
Block a user