Use base::weak_qptr / base::make_weak.

This commit is contained in:
John Preston
2025-07-18 10:07:39 +04:00
parent 321c7120df
commit b754ad5248
189 changed files with 556 additions and 555 deletions

View File

@@ -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);
}
});

View File

@@ -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());