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

@@ -1096,7 +1096,7 @@ void Controller::showMenu() {
}
_menu->setDestroyedCallback(crl::guard(_window.get(), [
this,
weakButton = Ui::MakeWeak(_menuToggle.data()),
weakButton = base::make_weak(_menuToggle.data()),
menu = _menu.get()] {
if (_menu == menu && weakButton) {
weakButton->setForceRippled(false);

View File

@@ -315,11 +315,11 @@ ShareBoxResult Shown::shareBox(ShareBoxDescriptor &&descriptor) {
};
const auto state = wrap->lifetime().make_state<State>();
const auto weak = QPointer<Ui::RpWidget>(wrap);
const auto weak = base::make_weak(wrap);
const auto lookup = crl::guard(weak, [state] { return state->stack; });
const auto layer = Ui::CreateChild<Ui::LayerStackWidget>(
wrap.get(),
[=] { return std::make_shared<Show>(weak.data(), lookup); });
[=] { return std::make_shared<Show>(weak.get(), lookup); });
state->stack = layer;
const auto show = layer->showFactory()();

View File

@@ -22,9 +22,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/flat_map.h"
#include "base/flat_set.h"
#include "base/weak_qptr.h"
#include "ui/qt_object_factory.h"
#include "ui/qt_weak_factory.h"
#include "scheme.h"
#include "logs.h"