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
+2 -2
View File
@@ -307,7 +307,7 @@ object_ptr<BoxContent> EditSkipTranslationLanguages() {
auto title = tr::lng_translate_settings_choose();
const auto selected = std::make_shared<std::vector<LanguageId>>(
Core::App().settings().skipTranslationLanguages());
const auto weak = std::make_shared<QPointer<BoxContent>>();
const auto weak = std::make_shared<base::weak_qptr<BoxContent>>();
const auto check = [=](LanguageId id) {
const auto already = ranges::contains(*selected, id);
if (already) {
@@ -316,7 +316,7 @@ object_ptr<BoxContent> EditSkipTranslationLanguages() {
selected->push_back(id);
}
if (already && selected->empty()) {
if (const auto strong = weak->data()) {
if (const auto strong = weak->get()) {
strong->showToast(
tr::lng_translate_settings_one(tr::now),
kSkipAtLeastOneDuration);